/* ==================== MODAL STYLES ==================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

.modal-content.modal-lg {
    max-width: 800px;
}

.modal-content.modal-xl {
    max-width: 1000px;
}

.modal-content.modal-fullscreen {
    max-width: 95%;
    width: 95%;
    height: 90vh;
    max-height: 90vh;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.modal-header h2 {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    color: var(--primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
    background: none;
    border: none;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--danger);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

/* ==================== FORM STYLES ==================== */

.form-section {
    margin-bottom: 24px;
}

.form-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group label .required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: var(--bg-white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 178, 0.1);
}

.form-group input.readonly,
.form-group input[readonly] {
    background: var(--bg-light);
    color: var(--text-secondary);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ==================== DETAIL VIEW STYLES ==================== */

.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 12px;
    margin-bottom: 24px;
}

.detail-avatar {
    width: 64px;
    height: 64px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}

.detail-title {
    flex: 1;
}

.detail-title h3 {
    font-size: 20px;
    margin-bottom: 4px;
}

.detail-title .detail-id {
    color: var(--text-secondary);
    font-size: 13px;
    margin-right: 12px;
}

.detail-actions {
    display: flex;
    gap: 8px;
}

.detail-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.detail-tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.detail-tab:hover {
    color: var(--primary);
}

.detail-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item.full-width {
    grid-column: span 2;
}

.detail-label {
    font-size: 12px;
    color: var(--text-light);
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
}

/* Team Assigned */
.team-assigned-list {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.team-assigned-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: 8px;
}

.team-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.team-avatar.marketing { background: var(--marketing-color); }
.team-avatar.sales { background: var(--sales-color); }
.team-avatar.cs { background: var(--cs-color); }

.team-info {
    display: flex;
    flex-direction: column;
}

.team-name {
    font-weight: 600;
    font-size: 14px;
}

.team-role {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Stats Mini Grid */
.stats-mini-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-mini {
    text-align: center;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
}

.stat-mini-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.stat-mini-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==================== CONTRACT SPECIFIC ==================== */

.contract-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-light), #E3F2FD);
    border-radius: 12px;
    margin-bottom: 24px;
}

.contract-number {
    flex: 1;
}

.contract-number .label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
}

.contract-number .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.coverage-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.coverage-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.coverage-item.included {
    background: #E8F5E9;
    color: #2E7D32;
}

.coverage-item.included i {
    color: #4CAF50;
}

.coverage-item.excluded {
    background: #FFEBEE;
    color: #C62828;
}

.contract-assets {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 16px;
}

.data-table.compact th,
.data-table.compact td {
    padding: 10px 12px;
    font-size: 13px;
}

.view-more {
    text-align: center;
    padding: 12px;
    color: var(--primary);
    font-weight: 500;
    cursor: pointer;
}

.view-more:hover {
    text-decoration: underline;
}

/* Document List */
.document-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.document-item:hover {
    background: var(--primary-light);
}

.doc-icon {
    width: 48px;
    height: 48px;
    background: #FFEBEE;
    color: #C62828;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.doc-info {
    flex: 1;
}

.doc-name {
    display: block;
    font-weight: 500;
    font-size: 14px;
}

.doc-size {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==================== PDF VIEWER ==================== */

.pdf-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    margin-right: 16px;
}

.zoom-level {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: center;
}

.page-info {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 0 16px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.pdf-body {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: #525659;
    height: 100%;
}

.pdf-container {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
}

.pdf-page {
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 210mm;
    min-height: 297mm;
    padding: 20mm;
}

.pdf-content {
    font-family: 'Times New Roman', serif;
    font-size: 12pt;
    line-height: 1.6;
    color: #333;
}

.pdf-header-doc {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #333;
}

.company-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.company-logo i {
    font-size: 32px;
    color: var(--primary);
}

.company-logo span {
    font-size: 18pt;
    font-weight: bold;
    letter-spacing: 2px;
}

.doc-title h1 {
    font-size: 16pt;
    margin-bottom: 5px;
}

.doc-title h2 {
    font-size: 14pt;
    font-weight: normal;
    margin-bottom: 10px;
}

.doc-title p {
    font-size: 12pt;
    color: #666;
}

.pdf-body-doc p {
    text-align: justify;
    margin-bottom: 15px;
}

.party-section {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-left: 3px solid var(--primary);
}

.party-section h3 {
    font-size: 12pt;
    margin-bottom: 10px;
}

.party-table {
    width: 100%;
}

.party-table td {
    padding: 5px 0;
}

.article-section {
    margin: 25px 0;
}

.article-section h3 {
    font-size: 12pt;
    margin-bottom: 10px;
}

.article-section ul {
    margin-left: 30px;
    margin-bottom: 15px;
}

.article-section li {
    margin-bottom: 5px;
}

.pdf-footer-doc {
    text-align: center;
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    font-size: 10pt;
    color: #666;
}

.pdf-thumbnails {
    width: 80px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.thumbnail {
    width: 60px;
    height: 80px;
    background: white;
    border: 2px solid transparent;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.thumbnail:hover {
    border-color: var(--primary);
}

.thumbnail.active {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 102, 178, 0.3);
}

/* ==================== UPLOAD AREA ==================== */

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-area i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 16px;
}

.upload-area p {
    font-size: 16px;
    margin-bottom: 8px;
}

.upload-area span {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ==================== BRANCH STYLES ==================== */

.branch-tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 10px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: span 1;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-item.full-width {
        grid-column: span 1;
    }

    .stats-mini-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .coverage-list {
        grid-template-columns: 1fr;
    }

    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pdf-body {
        flex-direction: column;
    }

    .pdf-thumbnails {
        flex-direction: row;
        width: 100%;
        height: auto;
        overflow-x: auto;
    }

    .pdf-page {
        width: 100%;
        min-height: auto;
        padding: 20px;
    }
}
