/* ReguVault - Professional SaaS Styling */

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    
    --bg-color: #f8fafc;
    --bg-secondary: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-color);
    min-height: 100vh;
}

/* ========== Header ========== */
.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 1001;
}

.nav-line {
    width: 25px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-nav-toggle.active .nav-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-nav-toggle.active .nav-line:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.active .nav-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.header-nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex: 1;
    margin-left: 2rem;
}

.header-left {
    display: flex;
    align-items: center;
}

.main-nav {
    display: flex;
    gap: 1rem;
}

.main-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary-color);
    background: #eff6ff;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border-radius: var(--radius);
    cursor: pointer;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
}

.user-menu:hover .user-dropdown {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
}

.user-dropdown a:hover {
    background: var(--bg-color);
}

/* ========== Container & Layout ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dashboard-actions {
    margin-top: 1rem;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== Cards & Stats ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card-warning {
    border-left: 4px solid var(--warning-color);
}

.stat-icon {
    font-size: 2rem;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.stat-limit,
.stat-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ========== Projects Grid ========== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.project-header h3 {
    font-size: 1.125rem;
    margin: 0;
}

.project-header a {
    color: var(--text-primary);
    text-decoration: none;
}

.project-header a:hover {
    color: var(--primary-color);
}

.project-info {
    margin-bottom: 1rem;
}

.project-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.meta-item {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.project-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.stat-badge {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.project-alert {
    background: #fef3c7;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.project-date {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    text-transform: capitalize;
}

.badge-draft {
    background: #f1f5f9;
    color: #475569;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-archived {
    background: #f1f5f9;
    color: #64748b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-customer {
    background: #dbeafe;
    color: #1e40af;
}

.badge-agency {
    background: #fce7f3;
    color: #9f1239;
}

.badge-admin {
    background: #fef3c7;
    color: #92400e;
}

.badge-external {
    background: #dbeafe;
    color: #1e40af;
}

.badge-internal {
    background: #f1f5f9;
    color: #475569;
}

/* ========== Alerts ========== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background: #dcfce7;
    border-color: var(--success-color);
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    border-color: var(--error-color);
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    border-color: var(--warning-color);
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border-color: var(--info-color);
    color: #1e40af;
}

.alert h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.alert ul {
    margin-left: 1.25rem;
    margin-top: 0.5rem;
}

/* ========== Forms ========== */
.form-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.standard-form,
.auth-form,
.wizard-form {
    max-width: 100%;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.required {
    color: var(--error-color);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.form-help {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.form-group .error {
    display: block;
    color: var(--error-color);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.radio-label input,
.checkbox-label input {
    width: auto;
}

/* ========== Auth Pages ========== */
.auth-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 500px;
}

.auth-box {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
}

.auth-box h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.demo-accounts {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: var(--radius);
    font-size: 0.8125rem;
}

.demo-accounts p {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.demo-accounts ul {
    list-style: none;
}

.demo-accounts li {
    padding: 0.25rem 0;
    font-family: monospace;
}

/* ========== Sections ========== */
.section {
    margin-bottom: 2rem;
}

.section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.info-box,
.info-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-box h3 {
    margin-bottom: 0.5rem;
}

.info-panel h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.info-item span {
    color: var(--text-primary);
}

/* ========== Empty States ========== */
.empty-state,
.empty-state-small {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state-small {
    padding: 2rem 1rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ========== Tables ========== */
.admin-table,
.clients-table {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-color);
}

th {
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-color);
}

/* ========== Region Selection ========== */
.regions-selection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.region-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all 0.2s;
}

.region-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.region-selected {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.region-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.region-header h3 {
    font-size: 1.125rem;
    margin: 0;
}

.region-code {
    background: var(--bg-color);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.region-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.region-legislation {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.region-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.region-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.region-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.region-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
}

.region-info {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.region-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.price {
    font-weight: 600;
    color: var(--primary-color);
}

/* ========== Wizard ========== */
.wizard-container {
    max-width: 900px;
    margin: 0 auto;
}

.wizard-header {
    text-align: center;
    margin-bottom: 2rem;
}

.wizard-progress {
    margin-bottom: 2rem;
}

.progress-bar {
    background: var(--bg-color);
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    height: 100%;
    transition: width 0.3s;
}

.progress-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.wizard-steps {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.step-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-secondary);
}

.step-indicator.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.step-indicator.completed {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.wizard-disclaimer {
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.wizard-questions {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

.wizard-question {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.wizard-question:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

/* ========== Documents ========== */
.document-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.region-header {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.document-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.document-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.document-icon {
    font-size: 2rem;
}

.document-info {
    flex: 1;
}

.document-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.document-actions {
    display: flex;
    gap: 0.5rem;
}

.document-preview {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

.document-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* ========== Footer ========== */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    margin-top: 4rem;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-right {
    display: flex;
    gap: 1.5rem;
}

.footer-right a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
}

.footer-right a:hover {
    color: var(--primary-color);
}

/* ========== Filters ========== */
.filters {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-form {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-form input,
.filter-form select {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
}

.filter-form input {
    flex: 1;
    min-width: 300px;
}

/* ========== Action Grid ========== */
.action-grid,
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.action-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    flex: 1;
    min-width: 150px;
}

.action-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.action-label {
    font-weight: 600;
}

/* ========== Version History ========== */
.version-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.version-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
}

.version-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.version-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.version-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========== Document List Preview ========== */
.document-list-preview {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.document-list-preview li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
}

.doc-icon {
    font-size: 1.25rem;
}

.doc-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.region-documents {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.region-documents h3 {
    margin-bottom: 0.75rem;
}

/* ========== Responsive Design - Mobile First ========== */

/* Tablet and below (1024px) */
@media (max-width: 1024px) {
    .header-container {
        padding: 1rem 1.5rem;
    }
    
    .container {
        max-width: 100%;
        padding: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Mobile landscape and below (768px) */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }
    
    /* Header */
    .site-header {
        position: relative; /* Not sticky on mobile */
    }
    
    .header-container {
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-top-bar {
        width: 100%;
        justify-content: space-between;
    }
    
    .logo {
        font-size: 1.375rem;
    }
    
    /* Mobile Nav Toggle */
    .mobile-nav-toggle {
        display: flex;
    }
    
    /* Mobile Nav Wrapper */
    .header-nav-wrapper {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin-left: 0;
        padding: 5rem 0 2rem;
        box-shadow: var(--shadow-lg);
        transition: right 0.3s ease;
        overflow-y: auto;
        z-index: 1000;
    }
    
    .header-nav-wrapper.active {
        right: 0;
    }
    
    /* Mobile Overlay */
    .site-header.nav-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    /* Mobile Main Nav */
    .header-left {
        width: 100%;
    }
    
    .main-nav {
        flex-direction: column;
        width: 100%;
        gap: 0;
        padding: 1rem 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-nav a {
        text-align: left;
        padding: 1rem 1.5rem;
        border-radius: 0;
        border-left: 3px solid transparent;
    }
    
    .main-nav a:hover,
    .main-nav a.active {
        background: #eff6ff;
        border-left-color: var(--primary-color);
    }
    
    /* Mobile User Menu */
    .header-right {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
        padding: 1rem 1.5rem;
    }
    
    .user-menu {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
        text-align: left;
    }
    
    .user-name {
        display: block;
        padding: 0.5rem 0;
        font-size: 0.9375rem;
        color: var(--text-secondary);
    }
    
    .logout-link {
        width: 100%;
        text-align: center;
        display: block;
        padding: 0.875rem 1rem;
        background: var(--error-color);
        color: white;
        border-radius: var(--radius);
        font-weight: 500;
    }
    
    .logout-link:hover {
        background: #dc2626;
    }
    
    /* Container */
    .container {
        padding: 1rem;
        margin: 1rem auto;
    }
    
    /* Page Header */
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .page-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .page-actions .btn {
        width: 100%;
    }
    
    /* Buttons */
    .btn {
        padding: 0.75rem 1rem;
        min-height: 44px; /* Touch-friendly */
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .btn-lg {
        padding: 0.875rem 1.25rem;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    /* Projects Grid */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .project-card {
        padding: 1.25rem;
    }
    
    /* Cards */
    .card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .card-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .card-actions .btn {
        width: 100%;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-label {
        font-size: 0.9375rem;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* Filter Form */
    .filter-form {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-form input,
    .filter-form select {
        min-width: 100%;
        width: 100%;
    }
    
    .filter-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-actions .btn {
        width: 100%;
    }
    
    /* Tables */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    .table {
        min-width: 600px;
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }
    
    /* Badges */
    .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Alerts */
    .alert {
        padding: 1rem;
        font-size: 0.9375rem;
    }
    
    /* Breadcrumb */
    .breadcrumb {
        flex-wrap: wrap;
        font-size: 0.875rem;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .pagination a,
    .pagination span {
        min-width: 40px;
        height: 40px;
        padding: 0.5rem;
    }
    
    /* Tabs */
    .tabs-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .tab-link {
        flex: 1 1 auto;
        text-align: center;
        font-size: 0.9375rem;
    }
    
    /* Document Viewer */
    .document-viewer {
        padding: 1rem;
    }
    
    .document-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .document-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .document-actions .btn {
        width: 100%;
    }
    
    /* Wizard */
    .wizard-steps {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .wizard-step {
        padding: 0.75rem;
    }
    
    .wizard-navigation {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    
    .wizard-navigation .btn {
        width: 100%;
    }
    
    /* Modal */
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Sidebar */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        transition: left 0.3s;
        z-index: 1000;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    /* Empty State */
    .empty-state {
        padding: 2rem 1rem;
    }
    
    .empty-state-icon {
        font-size: 3rem;
    }
    
    .empty-state h3 {
        font-size: 1.25rem;
    }
}

/* Small mobile (480px) */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 0.75rem;
        margin: 0.75rem auto;
    }
    
    .header-container {
        padding: 0.75rem;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .main-nav a {
        padding: 0.625rem;
        font-size: 0.9375rem;
    }
    
    .page-header h1 {
        font-size: 1.375rem;
    }
    
    .btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.9375rem;
    }
    
    .card,
    .stat-card,
    .project-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.625rem;
    }
    
    .table {
        font-size: 0.8125rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.375rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .alert {
        padding: 0.875rem;
        font-size: 0.875rem;
    }
}

/* Extra small devices (360px) */
@media (max-width: 360px) {
    body {
        font-size: 13px;
    }
    
    .logo {
        font-size: 1.125rem;
    }
    
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .card {
        padding: 0.875rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .header-container {
        padding: 0.5rem 1rem;
    }
    
    .main-nav a {
        padding: 0.375rem 0.75rem;
    }
    
    .container {
        margin: 0.5rem auto;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets */
    .btn,
    .main-nav a,
    .tab-link,
    .pagination a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects */
    .card:hover,
    .project-card:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 2px solid var(--border-color);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .site-header,
    .page-actions,
    .card-actions,
    .btn,
    .filter-form {
        display: none;
    }
    
    body {
        font-size: 12pt;
        color: #000;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

