/* PolicyVault Shared Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --navy: #0a1628;
    --deep-blue: #0f2140;
    --accent: #c9a84c;
    --accent-light: #e4cc7a;
    --accent-dark: #a88a3a;
    --text: #e8edf5;
    --text-muted: #8a99b4;
    --surface: #132240;
    --surface-light: #1a2d52;
    --danger: #e74c3c;
    --success: #48bb78;
    --info: #63b3ed;
    --warning: #f6ad55;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--navy);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: 'Space Grotesk', sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-light); }

/* App Nav */
.app-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    max-width: 1200px;
    margin: 0 auto;
    border-bottom: 1px solid var(--surface-light);
}

.app-nav .logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.app-nav .logo span { color: var(--text); }

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--accent);
}

.nav-links .btn-nav {
    background: var(--accent);
    color: var(--navy);
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.nav-links .btn-nav:hover {
    background: var(--accent-light);
    color: var(--navy);
}

/* Page Container */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 5%;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Cards */
.card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--deep-blue) 100%);
    border: 1px solid var(--surface-light);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

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

.card-header h2 {
    font-size: 1.3rem;
    letter-spacing: -0.3px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: 12px;
    padding: 1.5rem;
}

.stat-card .stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Forms */
.form-section {
    max-width: 560px;
    margin: 0 auto;
}

.form-section.wide {
    max-width: 800px;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
    font-family: 'Space Grotesk', sans-serif;
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a99b4' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-group select option {
    background: var(--surface);
    color: var(--text);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-divider {
    border: none;
    border-top: 1px solid var(--surface-light);
    margin: 1.5rem 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--navy);
    width: 100%;
}

.btn-primary:hover {
    background: var(--accent-light);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-secondary:hover {
    background: var(--surface);
    border-color: var(--accent);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-outline:hover {
    background: rgba(201, 168, 76, 0.1);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    display: none;
}

.alert.show { display: block; }

.alert-error {
    background: rgba(231, 76, 60, 0.12);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #ff6b6b;
}

.alert-success {
    background: rgba(72, 187, 120, 0.12);
    border: 1px solid rgba(72, 187, 120, 0.3);
    color: #68d391;
}

.alert-info {
    background: rgba(99, 179, 237, 0.12);
    border: 1px solid rgba(99, 179, 237, 0.3);
    color: #90cdf4;
}

.alert-warning {
    background: rgba(246, 173, 85, 0.12);
    border: 1px solid rgba(246, 173, 85, 0.3);
    color: #fbd38d;
}

/* Role Selector */
.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.role-option {
    background: var(--surface);
    border: 2px solid var(--surface-light);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.role-option:hover {
    border-color: var(--accent);
}

.role-option.selected {
    border-color: var(--accent);
    background: rgba(201, 168, 76, 0.08);
}

.role-option .role-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.role-option h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.role-option p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--surface-light);
}

.data-table tbody td {
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(138, 153, 180, 0.1);
}

.data-table tbody tr:hover {
    background: rgba(201, 168, 76, 0.03);
}

/* Badges */
.badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active { background: rgba(72, 187, 120, 0.15); color: #48bb78; }
.badge-locked { background: rgba(201, 168, 76, 0.15); color: var(--accent); }
.badge-verified { background: rgba(72, 187, 120, 0.15); color: #48bb78; }
.badge-pending { background: rgba(246, 173, 85, 0.15); color: #f6ad55; }
.badge-term { background: rgba(99, 179, 237, 0.15); color: #63b3ed; }
.badge-whole { background: rgba(183, 148, 244, 0.15); color: #b794f4; }
.badge-universal { background: rgba(246, 173, 85, 0.15); color: #f6ad55; }

/* Search Results */
.search-result {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
}

.search-result.locked {
    border-left: 3px solid var(--accent);
}

.search-result.unlocked {
    border-left: 3px solid var(--success);
}

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

.result-header h3 {
    font-size: 1.1rem;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.result-field {
    display: flex;
    flex-direction: column;
}

.result-field .field-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.result-field .field-value {
    font-size: 0.95rem;
    font-weight: 500;
}

.result-field .field-value.redacted {
    color: var(--text-muted);
    font-style: italic;
}

/* Locked overlay */
.lock-overlay {
    background: rgba(201, 168, 76, 0.06);
    border: 1px dashed var(--accent);
    border-radius: 8px;
    padding: 1.25rem;
    margin-top: 1rem;
    text-align: center;
}

.lock-overlay .lock-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.lock-overlay p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 22, 40, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--deep-blue);
    border: 1px solid var(--surface-light);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.modal p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Beneficiary Entry */
.beneficiary-entry {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    position: relative;
}

.beneficiary-entry .entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.beneficiary-entry .entry-header h4 {
    font-size: 0.9rem;
    color: var(--accent);
}

.remove-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}

.remove-btn:hover {
    text-decoration: underline;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

/* Auth page center layout */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 70px);
    padding: 2rem 5%;
}

.auth-card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--deep-blue) 100%);
    border: 1px solid var(--surface-light);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 480px;
}

.auth-card h1 {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }
    .role-selector {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .result-details {
        grid-template-columns: 1fr 1fr;
    }
    .app-nav {
        flex-direction: column;
        gap: 0.75rem;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .auth-card {
        padding: 1.5rem;
    }
}
