/* Custom font */
@font-face {
    font-family: 'Optician Sans';
    src: url('fonts/Optician-Sans.otf') format('opentype');
    font-display: swap;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background-color: #2c2c2c;
    color: #fff;
    text-align: center;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-family: 'Optician Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    color: #ccc;
    margin-bottom: 0.75rem;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    font-size: 0.85rem;
}

.header-nav a {
    color: #cbd5e0;
    text-decoration: none;
    transition: color 0.2s ease;
}

.header-nav a:hover {
    color: #e2e8f0;
    text-decoration: underline;
}

.header-nav a:visited {
    color: #d6bcfa;
}

.header-nav a:active {
    color: #f7fafc;
}

/* Toolbar */
.toolbar {
    background-color: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    padding: 1.5rem 1rem;
}

.toolbar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.all-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.btn-export {
    padding: 0.6rem 1.2rem;
    background-color: #4a5568;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-export:hover {
    background-color: #2d3748;
}

.btn-copy {
    background-color: #38a169 !important;
}

.btn-copy:hover {
    background-color: #2f855a !important;
}


.btn-reset {
    padding: 0.5rem 1rem;
    background-color: #e53e3e;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-reset:hover {
    background-color: #c53030;
}

/* Main content */
main {
    flex: 1;
    padding: 2rem 1rem;
}

/* Page content for static pages */
.page-content {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    line-height: 1.6;
}

.page-content h2 {
    font-family: 'Optician Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #333;
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.75rem;
}

.page-content h3 {
    font-family: 'Optician Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #4a5568;
    font-size: 1.3rem;
    font-weight: 500;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.page-content p {
    margin-bottom: 1.2rem;
    color: #555;
}

.page-content ul {
    margin-bottom: 1.2rem;
    padding-left: 1.5rem;
}

.page-content li {
    margin-bottom: 0.5rem;
    color: #555;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

/* Document title section */
.document-title-section {
    grid-column: 1 / -1;
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    margin-bottom: 1rem;
}

.document-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.document-title-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 500;
    transition: border-color 0.2s;
}

.document-title-input:focus {
    outline: none;
    border-color: #4a5568;
}

.document-title-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
    cursor: pointer;
}

.document-title-checkbox {
    cursor: pointer;
}

.document-title-stats {
    display: flex;
    gap: 2rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: #666;
    line-height: 1;
}

.title-stat strong {
    color: #333;
    font-weight: 600;
}

/* Sections container */
.sections-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Individual section */
.section {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1rem;
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

/* Section counter (left side) */
.section-counter {
    background-color: #f5f5f5;
    border-radius: 6px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
}

.section-counter h4 {
    font-family: 'Optician Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #555;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
}

.counter-stats {
    flex: 1;
}

.stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    line-height: 1;
}

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #333;
}

.section-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-add {
    background-color: #4a5568;
    color: white;
}

.btn-add:hover {
    background-color: #2d3748;
}

.btn-delete {
    background-color: #e53e3e;
    color: white;
}

.btn-delete:hover {
    background-color: #c53030;
}

.btn:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}

/* Section content */
.section-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.section-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-title-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.section-title-input:focus {
    outline: none;
    border-color: #4a5568;
}

.title-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
    cursor: pointer;
}

.title-checkbox {
    cursor: pointer;
}

/* Text area */
.section-textarea {
    width: 100%;
    min-height: 160px;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.section-textarea:focus {
    outline: none;
    border-color: #4a5568;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 2rem;
    align-self: start;
}

/* Total counter */
.total-counter {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.total-counter h3 {
    font-family: 'Optician Sans', -apple-system, BlinkMacSystemFont, 'Segue UI', Roboto, sans-serif;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    text-align: center;
    line-height: 1;
}

.total-counter .counter-stats {
    gap: 0;
}

.total-counter .stat {
    margin-bottom: 0.25rem;
    padding: 0.1rem 0;
}

.total-counter .stat:last-child {
    margin-bottom: 0;
}

.total-counter .stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
}

/* Ad placeholder */
.ad-placeholder {
    width: 300px;
    height: 250px;
    background: #f8f9fa;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-content {
    text-align: center;
    color: #666;
}

.ad-content p {
    margin: 0;
    font-size: 0.9rem;
}

.ad-size {
    font-size: 0.75rem !important;
    color: #999 !important;
    margin-top: 0.25rem !important;
}

/* Links */
a {
    color: #4a5568;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #2d3748;
    text-decoration: underline;
}

a:visited {
    color: #553c9a;
}

a:active {
    color: #1a202c;
}

/* Footer links - lighter colors for dark background */
footer a {
    color: #cbd5e0;
}

footer a:hover {
    color: #e2e8f0;
    text-decoration: underline;
}

footer a:visited {
    color: #d6bcfa;
}

footer a:active {
    color: #f7fafc;
}

/* Footer */
footer {
    background-color: #2c2c2c;
    color: #ccc;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: auto;
}

/* Responsive design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .header-nav {
        gap: 1rem;
        font-size: 0.8rem;
    }
    
    .toolbar {
        padding: 1rem;
    }
    
    .all-buttons {
        gap: 0.5rem;
    }
    
    .btn-export {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .btn-reset {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .page-content {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }
    
    .page-content h2 {
        font-size: 1.75rem;
    }
    
    .page-content h3 {
        font-size: 1.2rem;
    }
    
    .document-title-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .document-title-checkbox-label {
        justify-content: center;
    }
    
    .document-title-stats {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .section {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .section-counter {
        min-height: auto;
        order: 2;
    }
    
    .section-content {
        order: 1;
    }
    
    .section-textarea {
        min-height: 150px;
    }
    
    .section-title-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .title-checkbox-label {
        justify-content: center;
    }
    
    .sidebar {
        position: static;
        order: -1;
        align-items: center;
    }
    
    .ad-placeholder {
        width: 280px;
        height: 200px;
    }
    
    .section-controls {
        flex-direction: row;
        justify-content: space-between;
    }
    
    main {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    .section {
        padding: 1rem;
    }
    
    .section-counter {
        padding: 0.75rem;
    }
    
    .total-counter {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}