/**
 * Contracts Page Styles
 * Legal documents page styling for ИЗМЕРЕНИЯ
 */

/* =====================================================
   CSS Variables
   ===================================================== */
:root {
    --primary-color: #4a6cf7;
    --primary-dark: #3a5bd9;
    --secondary-color: #667eea;
    --text-color: #333;
    --text-light: #666;
    --text-muted: #999;
    --bg-light: #f8f9fa;
    --bg-white: #fff;
    --border-color: #e0e0e0;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* =====================================================
   Base Styles
   ===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    min-height: 100vh;
}

/* =====================================================
   Header
   ===================================================== */
.contracts-header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo img {
    height: 40px;
    width: auto;
}

.header-nav {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

/* =====================================================
   Main Content
   ===================================================== */
.contracts-main {
    padding: 40px 24px 60px;
}

.contracts-container {
    max-width: 1000px;
    margin: 0 auto;
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 16px;
}

.page-description {
    font-size: 16px;
    color: var(--text-light);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.7;
}

/* User Type Info Box */
.user-type-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 32px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    border: 1px solid rgba(33, 150, 243, 0.2);
}

.info-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.info-text strong {
    display: block;
    margin-bottom: 4px;
    color: #1565c0;
}

.info-text p {
    color: #1976d2;
    margin: 0;
    font-size: 14px;
}

/* =====================================================
   Contract Cards Grid
   ===================================================== */
.contracts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 48px;
}

.contract-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.contract-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Highlight card based on URL hash */
.contract-card:target {
    box-shadow: 0 0 0 3px var(--primary-color), var(--shadow-lg);
}

/* Contract Badge */
.contract-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contract-badge.legal {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.contract-badge.individual {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

/* Contract Icon */
.contract-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* Contract Title */
.contract-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.contract-subtitle {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 16px;
}

.contract-description {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 20px;
    flex-grow: 1;
}

/* Contract Meta */
.contract-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.meta-icon {
    font-size: 14px;
}

/* Contract Actions */
.contract-actions {
    display: flex;
    gap: 12px;
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 108, 247, 0.4);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.btn-icon {
    font-size: 16px;
}

/* =====================================================
   FAQ Section
   ===================================================== */
.faq-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
}

.section-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 24px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-light);
    border: none;
    text-align: left;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-family: inherit;
    transition: background-color 0.3s ease;
}

.faq-question:hover {
    background: #e9ecef;
}

.faq-toggle {
    font-size: 20px;
    font-weight: 300;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.faq-item.open .faq-toggle {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item.open .faq-answer {
    padding: 16px 20px;
    max-height: 500px;
}

.faq-answer p {
    margin-bottom: 12px;
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.7;
}

.faq-answer p:last-child {
    margin-bottom: 0;
}

.faq-answer ul {
    margin: 12px 0;
    padding-left: 24px;
}

.faq-answer li {
    margin-bottom: 8px;
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
}

/* =====================================================
   Contact Section
   ===================================================== */
.contact-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    margin-bottom: 32px;
}

.contact-text {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 15px;
}

.contact-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.contact-link:hover {
    color: var(--primary-dark);
}

.contact-icon {
    font-size: 18px;
}

.contact-divider {
    color: var(--text-muted);
}

.contact-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
}

/* =====================================================
   Disclaimer
   ===================================================== */
.disclaimer {
    background: #fff8e1;
    border: 1px solid #ffecb3;
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 32px;
}

.disclaimer p {
    color: #f57c00;
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
}

/* =====================================================
   Modal
   ===================================================== */
.contract-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.contract-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-light);
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #e9ecef;
    color: var(--text-color);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.contract-viewer {
    min-height: 400px;
}

.contract-viewer iframe {
    width: 100%;
    height: 60vh;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.contract-viewer .contract-text {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-color);
}

.contract-viewer .contract-text h1,
.contract-viewer .contract-text h2,
.contract-viewer .contract-text h3 {
    margin: 24px 0 12px;
    color: var(--text-color);
}

.contract-viewer .contract-text p {
    margin-bottom: 12px;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* =====================================================
   Footer
   ===================================================== */
.contracts-footer {
    background: #1a1a2e;
    color: rgba(255, 255, 255, 0.7);
    padding: 24px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-left p {
    font-size: 13px;
    margin: 0;
    line-height: 1.6;
}

.footer-right {
    display: flex;
    gap: 24px;
}

.footer-right a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s ease;
}

.footer-right a:hover {
    color: white;
}

/* =====================================================
   Responsive Design
   ===================================================== */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 16px;
    }

    .header-nav {
        gap: 16px;
    }

    .contracts-main {
        padding: 24px 16px 40px;
    }

    .page-title {
        font-size: 26px;
    }

    .contracts-grid {
        grid-template-columns: 1fr;
    }

    .contract-card {
        padding: 24px;
    }

    .contract-actions {
        flex-direction: column;
    }

    .contact-info {
        flex-direction: column;
        gap: 12px;
    }

    .contact-divider {
        display: none;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }

    .footer-right {
        flex-direction: column;
        gap: 12px;
    }

    .modal-container {
        width: 95%;
        max-height: 95vh;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 22px;
    }

    .user-type-info {
        flex-direction: column;
        text-align: center;
    }

    .contract-badge {
        position: static;
        display: inline-block;
        margin-bottom: 12px;
    }

    .contract-meta {
        flex-direction: column;
        gap: 8px;
    }

    .faq-question {
        padding: 14px 16px;
        font-size: 14px;
    }
}

/* =====================================================
   Print Styles
   ===================================================== */
@media print {
    .contracts-header,
    .contracts-footer,
    .contract-actions,
    .faq-section,
    .contact-section,
    .user-type-info {
        display: none !important;
    }

    .contracts-main {
        padding: 0;
    }

    .contract-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .contracts-grid {
        display: block;
    }

    .contracts-grid .contract-card + .contract-card {
        margin-top: 24px;
    }
}
