/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 1400px;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    flex-grow: 1;
    flex-basis: 0;
}

@media (max-width: 1440px) {
    .container {
        width: 100%;
    }
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
}

@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2.5em;
    font-weight: 300;
}

.header p {
    color: #7f8c8d;
    font-size: 1.2em;
}

/* Search Section */
.search-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.search-input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
}

.filters {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filters select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    font-size: 14px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
    display: inline-block;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

#downloadFonts {
    margin-top: 30px;
    padding: 15px 40px;
    font-size: 18px;
    display: inline-block;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    font-size: 12px;
    padding: 8px 16px;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #7f8c8d;
    margin-top: 15px;
    font-size: 16px;
}

.loading .loading-details {
    font-size: 14px;
    color: #95a5a6;
    margin-top: 8px;
    font-style: italic;
}

/* Font List */
.font-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.font-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    border: 2px solid #e9ecef;
}

.font-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-color: #cbd5e0;
}

.font-card.selected {
    border-color: #3498db;
    background: #f8fbff;
}

.font-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 15px;
}

.font-name {
    font-size: 1.3em;
    font-weight: 500;
    color: #2c3e50;
    flex-grow: 1;
}

.font-category {
    background: #ecf0f1;
    color: #7f8c8d;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.font-preview {
    font-size: 24px;
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.font-variants {
    margin: 15px 0;
}

.font-variants h4 {
    font-size: 14px;
    color: #7f8c8d;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.variant-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.weight-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.weight-label {
    min-width: 100px;
    font-weight: 600;
    font-size: 13px;
    color: #2c3e50;
}

.style-options {
    display: flex;
    gap: 16px;
    flex: 1;
}

.variant-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
}

.variant-checkbox input {
    margin: 0;
    cursor: pointer;
}

.font-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

/* Selected Fonts Section */
/* Left Column */
.left-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Font List Section */
.font-list-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    height: 70vh;
    overflow-y: scroll;
    overflow-x: hidden;
}

.font-list-section .font-list {
    margin: 0;
}

/* Selected Fonts (now below search) */
.selected-fonts {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 40px;
    margin-bottom: 20px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.selected-fonts:not([style*="display: none"]) {
    border-color: #3498db;
}

/* Preview Column (now expanded) */
.preview-column {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
    height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.preview-column .preview-section {
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    height: 100%;
}

.preview-column .preview-section h3 {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: #2c3e50;
}

.preview-column .preview-section input[type="text"] {
    width: 100%;
    font-size: 1.1em;
    padding: 15px;
    margin-bottom: 25px;
}

/* Enhanced preview for expanded layout */
.preview-column .preview-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

.preview-column .preview-item {
    padding: 25px;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    background: #fdfdfd;
    transition: all 0.3s ease;
}

.preview-column .preview-item:hover {
    border-color: #3498db;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.1);
}

.preview-column .preview-font-name {
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ecf0f1;
}

.preview-column .preview-text {
    font-size: 2.2em !important;
    line-height: 1.4;
    color: #2c3e50;
}

/* Preview Placeholder */
.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60vh;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    border: 2px dashed #dee2e6;
}

.placeholder-content h2 {
    font-size: 2.5em;
    color: #6c757d;
    margin-bottom: 15px;
    font-weight: 300;
}

.placeholder-content p {
    font-size: 1.2em;
    color: #8e9194;
    margin-bottom: 25px;
}

.placeholder-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.feature {
    color: #6c757d;
    font-size: 1em;
    opacity: 0.8;
}

.selected-fonts h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.selected-font-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

.selected-font-info {
    flex-grow: 1;
}

.selected-font-name {
    font-weight: 500;
    color: #2c3e50;
}

.selected-font-variants {
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 4px;
}

.download-options {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.download-options label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    cursor: pointer;
}

.download-options input {
    margin-right: 8px;
}

/* Preview Section */
.preview-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.preview-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5em;
}

#previewText {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
}

.preview-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.preview-item {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.preview-item:last-child {
    border-bottom: none;
}

.preview-font-name {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 8px;
}

.preview-variant {
    margin-bottom: 20px;
}

.preview-variant:last-child {
    margin-bottom: 0;
}

.preview-variant-label {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-text {
    font-size: 24px;
    line-height: 1.4;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 2em;
    }

    .font-list {
        grid-template-columns: 1fr;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filters select,
    .filters button {
        width: 100%;
        margin-bottom: 10px;
    }

    .font-actions {
        flex-direction: column;
        gap: 10px;
    }

    .selected-font-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Advanced Options Styles */
.advanced-options {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.advanced-options .option-section {
    margin-bottom: 25px !important;
    padding: 20px !important;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.advanced-options .option-section:last-child {
    margin-bottom: 0 !important;
}

.advanced-options .option-section h4 {
    font-size: 16px !important;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px !important;
    margin-top: 0 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px !important;
}

.advanced-options .option-description {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 15px !important;
    font-style: italic;
}

.advanced-options .subset-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px !important;
}

.subset-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.subset-btn:hover {
    background: #0056b3;
}

.subset-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.subset-desc {
    font-size: 11px;
    color: #6c757d;
    font-style: italic;
    margin-left: 4px;
}

.option-help {
    display: block;
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
    margin-top: 2px;
    margin-left: 20px;
}

.subset-options label,
.performance-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
}

.subset-options input[type="checkbox"],
.performance-options input[type="checkbox"] {
    cursor: pointer;
}

.performance-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-group label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 4px;
}

.option-group select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    max-width: 200px;
}

.advanced-options .critical-fonts-list {
    display: flex !important;
    flex-direction: column;
    gap: 8px !important;
    padding: 15px !important;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    min-height: 60px;
    margin-top: 10px !important;
}

.advanced-options .critical-fonts-list label {
    font-size: 14px !important;
    display: flex !important;
    align-items: center;
    gap: 8px !important;
    padding: 5px !important;
    background: white;
    border-radius: 3px;
    border: 1px solid #e9ecef;
}

.advanced-options .critical-fonts-list input[type="checkbox"] {
    margin: 0 !important;
    padding: 0 !important;
}

.advanced-options .critical-fonts-list:empty::after {
    content: "No fonts selected yet. Select fonts above to see preload options here.";
    color: #6c757d;
    font-size: 13px;
    font-style: italic;
    text-align: center;
    padding: 15px;
}
/* Footer Styles */
.footer {
    width: 100%;
    margin-top: 0;
    padding: 30px 20px;
    /*background: #f8f9fa;*/
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 auto;
}

.footer-content {
    max-width: 1200px;
    text-align: center;
}

.footer-copyright {
    margin: 0 0 15px 0;
    color: #6c757d;
    font-size: 14px;
}

.footer-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-link {
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #2980b9;
    text-decoration: underline;
}

.footer-separator {
    color: #adb5bd;
    font-size: 14px;
    user-select: none;
}

/* Responsive footer */
@media (max-width: 768px) {
    .footer {
        margin-top: 0;
        padding: 20px 15px;
    }
    
    .footer-nav {
        flex-direction: column;
        gap: 12px;
    }
    
    .footer-separator {
        display: none;
    }
}
