:root {
    --primary-color: #2196F3;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    --danger-color: #F44336;
    --purple-color: #9C27B0;
    --background-color: #f5f5f5;
    --surface-color: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    padding-bottom: 80px;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--purple-color));
    color: white;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.notification-badge {
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.main-content {
    flex: 1;
    padding: 1rem;
    max-width: 100%;
    overflow-x: hidden;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.compliance-score .score-display {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.score-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
}

.score-percentage {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.score-status {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.risk-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.risk-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.risk-circle.low { background-color: var(--success-color); }
.risk-circle.medium { background-color: var(--warning-color); }
.risk-circle.high { background-color: var(--danger-color); }

.pending-count {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--warning-color);
}

.pending-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.deadline-date {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
}

.deadline-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.chart-container {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.chart-container h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.chart-container canvas {
    max-width: 100% !important;
    max-height: 300px !important;
    width: 100% !important;
    height: auto !important;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
}

.chart-wrapper canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
}

.regime-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.regime-selector label {
    font-weight: 500;
    color: var(--text-primary);
}

.regime-selector select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.checklist-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.checklist-category {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.category-header {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.category-header:hover {
    background: #1976D2;
}

.category-progress {
    font-size: 0.9rem;
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

.category-items {
    padding: 0;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-item:hover {
    background: #f8f9fa;
}

.checklist-item input[type="checkbox"] {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    accent-color: var(--success-color);
}

.item-content {
    flex: 1;
}

.item-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.item-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.item-risk {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.item-risk.low { background: #e8f5e8; color: var(--success-color); }
.item-risk.medium { background: #fff8e1; color: #f57c00; }
.item-risk.high { background: #ffebee; color: var(--danger-color); }

.checklist-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #616161;
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 1rem;
}

.btn-text {
    font-weight: 500;
}

.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timeline-item {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
    transition: var(--transition);
}

.timeline-item:hover {
    box-shadow: var(--shadow-hover);
}

.timeline-item.completed {
    border-left-color: var(--success-color);
    opacity: 0.8;
}

.timeline-item.overdue {
    border-left-color: var(--danger-color);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.task-title {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.task-priority {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.task-priority.low { background: #e8f5e8; color: var(--success-color); }
.task-priority.medium { background: #fff8e1; color: #f57c00; }
.task-priority.high { background: #ffebee; color: var(--danger-color); }
.task-priority.critical { background: #f3e5f5; color: var(--purple-color); }

.task-description {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.task-deadline {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.task-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease-in-out;
}

.modal-content {
    background-color: var(--surface-color);
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease-in-out;
}

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

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.close:hover {
    color: var(--text-primary);
    background: var(--background-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.form-group input:invalid,
.form-group textarea:invalid {
    border-color: var(--danger-color);
}

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

.error-message {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    min-height: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.alert-item {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--warning-color);
    transition: var(--transition);
}

.alert-item.high {
    border-left-color: var(--danger-color);
}

.alert-item.critical {
    border-left-color: var(--purple-color);
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.alert-title {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.alert-close:hover {
    background: var(--background-color);
    color: var(--text-primary);
}

.alert-message {
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.alert-timestamp {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.faq-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1.5rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    background: var(--background-color);
}

.faq-question:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.faq-icon {
    font-size: 1.25rem;
    transition: var(--transition);
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-secondary);
    line-height: 1.5;
    animation: slideDown 0.3s ease-in-out;
}

.faq-answer[hidden] {
    display: none;
}

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

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
    min-width: 60px;
}

.nav-item:hover {
    background: var(--background-color);
}

.nav-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-weight: 500;
}

footer {
    background: var(--text-primary);
    color: white;
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
    margin-top: 2rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--border-color);
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-spinner {
    text-align: center;
    color: var(--primary-color);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators for keyboard navigation */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10001;
}

.skip-link:focus {
    top: 6px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
    
    .card {
        border: 2px solid var(--border-color);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 10000;
    font-weight: 500;
    max-width: 300px;
    word-wrap: break-word;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .checklist-actions,
    .form-actions {
        flex-direction: column;
    }
    
    .task-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .task-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 1.5rem;
    }
    
    .btn {
        padding: 0.875rem 1.25rem;
    }
    
    .btn-icon {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .app-header h1 {
        font-size: 1.1rem;
    }
    
    .bottom-nav {
        padding: 0.25rem 0;
    }
    
    .nav-item {
        font-size: 0.7rem;
        padding: 0.25rem;
        min-width: 50px;
    }
    
    .nav-item i {
        font-size: 1.1rem;
    }
    
    .score-value {
        font-size: 2.5rem;
    }
    
    .pending-count {
        font-size: 2rem;
    }
    
    .toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (min-width: 1024px) {
    .main-content {
        max-width: 1200px;
        margin: 0 auto;
        padding: 2rem;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .modal-content {
        margin: 10% auto;
        width: 80%;
        max-width: 600px;
    }
}

/* Print styles */
@media print {
    .bottom-nav,
    .modal,
    .loading-overlay,
    .toast {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-color);
        break-inside: avoid;
    }
    
    .content-section {
        display: block !important;
        page-break-before: always;
    }
    
    .content-section:first-child {
        page-break-before: avoid;
    }
}
