/* Frontend Styles - Primary Color: #265C6A */

:root {
    --primary-color: #265C6A;
    --primary-hover: #1e4a56;
    --primary-light: #e8f1f3;
}

.wp-articles-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Controls */
.wp-articles-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 15px;
    flex-wrap: wrap;
}

.wp-articles-search {
    flex: 1;
    min-width: 250px;
}

.wp-articles-search input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.wp-articles-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.wp-articles-view-toggle {
    display: flex;
    gap: 8px;
}

.view-toggle {
    background: #fff;
    border: 2px solid #e0e0e0;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.view-toggle:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.view-toggle.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* Grid View */
.wp-articles-grid.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.grid-view .article-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.grid-view .article-card:hover {
    box-shadow: 0 8px 24px rgba(38, 92, 106, 0.15);
    transform: translateY(-4px);
}

.grid-view .article-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--primary-light);
}

.grid-view .article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.grid-view .article-card:hover .article-image img {
    transform: scale(1.05);
}

.grid-view .article-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 500;
}

.grid-view .article-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.grid-view .article-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.4;
}

.grid-view .article-date {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #999;
    font-weight: 500;
}

.grid-view .article-subtext {
    margin: 0 0 10px 0;
    font-size: 15px;
    color: #666;
    line-height: 1.6;
}

.grid-view .article-body-preview {
    margin: 0;
    font-size: 14px;
    color: #888;
    line-height: 1.5;
    font-style: italic;
}

/* List View */
.wp-articles-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.list-view .article-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    min-height: 140px;
}

.list-view .article-card:hover {
    box-shadow: 0 4px 16px rgba(38, 92, 106, 0.15);
    transform: translateX(4px);
}

.list-view .article-image {
    width: 200px;
    min-width: 200px;
    height: auto;
    background: var(--primary-light);
}

.list-view .article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.list-view .article-card:hover .article-image img {
    transform: scale(1.05);
}

.list-view .article-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 500;
}

.list-view .article-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.list-view .article-title {
    margin: 0 0 8px 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.3;
}

.list-view .article-date {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #999;
    font-weight: 500;
}

.list-view .article-subtext {
    margin: 0 0 10px 0;
    font-size: 15px;
    color: #666;
    line-height: 1.6;
}

.list-view .article-body-preview {
    margin: 0;
    font-size: 14px;
    color: #888;
    line-height: 1.5;
    font-style: italic;
}

/* No Articles Message */
.no-articles {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #999;
}

/* Modal */
.wp-article-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    backdrop-filter: blur(5px);
    padding: 20px;
    overflow-y: auto;
}

.wp-article-modal-content {
    background: #fff;
    max-width: 700px;
    margin: 60px auto;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wp-article-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wp-article-modal-close:hover {
    background: var(--primary-hover);
    transform: rotate(90deg);
}

#wp-article-modal-body {
    padding: 30px;
}

.modal-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 20px;
}

.modal-title {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.3;
}

.modal-date {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #999;
    font-weight: 500;
}

.modal-subtext {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #666;
    font-weight: 500;
    line-height: 1.6;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-body {
    margin: 0 0 20px 0;
    font-size: 15px;
    color: #333;
    line-height: 1.7;
}

.modal-body p {
    margin: 0 0 16px 0;
}

.modal-body ul,
.modal-body ol {
    margin: 0 0 16px 20px;
    padding-left: 20px;
}

.modal-body ul li,
.modal-body ol li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.modal-body ul {
    list-style-type: disc;
}

.modal-body ol {
    list-style-type: decimal;
}

.modal-body strong,
.modal-body b {
    font-weight: 700;
    color: #222;
}

.modal-body em,
.modal-body i {
    font-style: italic;
}

.modal-body u {
    text-decoration: underline;
}

.modal-body blockquote {
    margin: 16px 0;
    padding: 12px 20px;
    border-left: 4px solid var(--primary-color);
    background: var(--primary-light);
    font-style: italic;
}

.modal-body a {
    color: var(--primary-color);
    text-decoration: underline;
}

.modal-body a:hover {
    color: var(--primary-hover);
}

.modal-body h1,
.modal-body h2,
.modal-body h3,
.modal-body h4,
.modal-body h5,
.modal-body h6 {
    margin: 20px 0 12px 0;
    color: var(--primary-color);
    font-weight: 700;
    line-height: 1.3;
}

.modal-body h1 { font-size: 24px; }
.modal-body h2 { font-size: 22px; }
.modal-body h3 { font-size: 20px; }
.modal-body h4 { font-size: 18px; }
.modal-body h5 { font-size: 16px; }
.modal-body h6 { font-size: 15px; }

.modal-body code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.modal-body pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 16px 0;
}

.modal-body pre code {
    background: none;
    padding: 0;
}

.modal-body hr {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 20px 0;
}

.modal-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 16px 0;
}

.modal-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.modal-body table th,
.modal-body table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

.modal-body table th {
    background: var(--primary-light);
    font-weight: 700;
    color: var(--primary-color);
}

.modal-link {
    display: inline-block;
    padding: 14px 28px;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
}

.modal-link:hover {
    background: var(--primary-hover);
    transform: translateX(4px);
    color: #fff;
}

body.modal-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wp-articles-container {
        padding: 15px;
    }
    
    .wp-articles-grid.grid-view {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .list-view .article-card {
        flex-direction: column;
    }
    
    .list-view .article-image {
        width: 100%;
        height: 200px;
    }
    
    .wp-article-modal {
        padding: 10px;
    }
    
    .wp-article-modal-content {
        margin: 20px auto;
        max-height: 90vh;
    }
    
    #wp-article-modal-body {
        padding: 25px 20px;
    }
    
    .modal-image {
        height: 220px;
    }
    
    .modal-title {
        font-size: 24px;
    }
    
    .modal-subtext {
        font-size: 15px;
    }
    
    .modal-body {
        font-size: 14px;
    }
    
    .wp-articles-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .wp-articles-search {
        width: 100%;
    }
    
    .wp-articles-view-toggle {
        justify-content: center;
    }
    
    .grid-view .article-image,
    .list-view .article-image {
        height: 180px;
    }
    
    .grid-view .article-content,
    .list-view .article-content {
        padding: 16px;
    }
    
    .grid-view .article-title,
    .list-view .article-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .wp-articles-container {
        padding: 10px;
    }
    
    .wp-articles-controls {
        gap: 10px;
    }
    
    .wp-articles-search input {
        padding: 10px 14px;
        font-size: 15px;
    }
    
    .view-toggle {
        padding: 8px 12px;
    }
    
    .grid-view .article-image,
    .list-view .article-image {
        height: 160px;
    }
    
    .grid-view .article-content,
    .list-view .article-content {
        padding: 14px;
    }
    
    .grid-view .article-title,
    .list-view .article-title {
        font-size: 17px;
    }
    
    .grid-view .article-subtext,
    .list-view .article-subtext {
        font-size: 14px;
    }
    
    .grid-view .article-body-preview,
    .list-view .article-body-preview {
        font-size: 13px;
    }
    
    .wp-article-modal-content {
        margin: 10px auto;
        border-radius: 12px;
    }
    
    #wp-article-modal-body {
        padding: 20px 16px;
    }
    
    .modal-image {
        height: 180px;
        margin-bottom: 16px;
        border-radius: 8px;
    }
    
    .modal-title {
        font-size: 22px;
        margin-bottom: 8px;
    }
    
    .modal-date {
        font-size: 12px;
        margin-bottom: 10px;
    }
    
    .modal-subtext {
        font-size: 14px;
        margin-bottom: 16px;
        padding-bottom: 16px;
    }
    
    .modal-body {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 16px;
    }
    
    .modal-body p {
        margin-bottom: 12px;
    }
    
    .modal-body ul,
    .modal-body ol {
        margin: 0 0 12px 15px;
        padding-left: 15px;
    }
    
    .modal-body ul li,
    .modal-body ol li {
        margin-bottom: 6px;
    }
    
    .modal-body h1 { font-size: 20px; }
    .modal-body h2 { font-size: 19px; }
    .modal-body h3 { font-size: 18px; }
    .modal-body h4 { font-size: 17px; }
    .modal-body h5 { font-size: 15px; }
    .modal-body h6 { font-size: 14px; }
    
    .modal-body blockquote {
        padding: 10px 15px;
        margin: 12px 0;
    }
    
    .modal-body table th,
    .modal-body table td {
        padding: 8px;
        font-size: 13px;
    }
    
    .modal-link {
        padding: 12px 24px;
        font-size: 15px;
    }
    
    .wp-article-modal-close {
        width: 36px;
        height: 36px;
        top: 12px;
        right: 12px;
        font-size: 20px;
    }
}

/* Extra small devices - improve touch targets and readability */
@media (max-width: 360px) {
    .wp-articles-search input {
        font-size: 14px;
    }
    
    .grid-view .article-title,
    .list-view .article-title {
        font-size: 16px;
    }
    
    .modal-title {
        font-size: 20px;
    }
    
    .modal-body {
        font-size: 13px;
    }
    
    .modal-body h1 { font-size: 18px; }
    .modal-body h2 { font-size: 17px; }
    .modal-body h3 { font-size: 16px; }
    .modal-body h4 { font-size: 15px; }
    .modal-body h5 { font-size: 14px; }
    .modal-body h6 { font-size: 13px; }
    
    .modal-body ul,
    .modal-body ol {
        margin: 0 0 10px 12px;
        padding-left: 12px;
    }
}
