/* Design Tokens */
:root {
    --deep-ink: #1a2332;
    --notaire-blue: #2d4a6e;
    --parchment: #f8f6f1;
    --french-clay: #e8dfd3;
    --legal-green: #2d6e4e;
    --amber-alert: #d97847;
    --warm-red: #c44536;
    --white: #ffffff;
    --text-primary: #1a2332;
    --text-secondary: #4a5568;
    --border: #d1d5db;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--parchment);
    color: var(--text-primary);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
}

/* Navbar */
.navbar {
    background-color: var(--deep-ink);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.75rem;
    color: var(--white);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: var(--white);
    text-decoration: none;
    transition: opacity 0.2s;
}

.nav-link:hover {
    opacity: 0.8;
}

.user-dropdown {
    position: relative;
}

.user-button {
    background: var(--notaire-blue);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.user-button:hover {
    background: #3a5a84;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 150px;
    display: none;
    z-index: 100;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-menu a:hover {
    background: var(--parchment);
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 450px;
}

.auth-box {
    background: var(--white);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.auth-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--deep-ink);
    text-align: center;
}

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

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--notaire-blue);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: #3a5a84;
}

.btn-secondary {
    background: var(--french-clay);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #d4cabb;
}

.btn-block {
    width: 100%;
    margin-top: 1rem;
}

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

.auth-footer a {
    color: var(--notaire-blue);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Content Pages */
.content-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

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

.page-header h1 {
    font-size: 2.5rem;
    color: var(--deep-ink);
}

.btn-back {
    background: transparent;
    border: none;
    color: var(--notaire-blue);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.btn-back:hover {
    opacity: 0.7;
}

.dossier-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Status Badges */
.status-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: capitalize;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.in_review {
    background: #d1ecf1;
    color: #0c5460;
}

.status-badge.approved {
    background: #d4edda;
    color: #155724;
}

.status-badge.completed {
    background: #d1d5db;
    color: #374151;
}

/* Transactions Grid */
.transactions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.transaction-card {
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.transaction-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.transaction-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--deep-ink);
}

.transaction-card .meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--french-clay);
    margin-bottom: 2rem;
}

.tab {
    background: transparent;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--notaire-blue);
}

.tab.active {
    color: var(--notaire-blue);
    border-bottom-color: var(--notaire-blue);
}

.tab-pane {
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--white);
}

.upload-zone:hover {
    border-color: var(--notaire-blue);
    background: var(--parchment);
}

.upload-zone.drag-over {
    border-color: var(--notaire-blue);
    background: var(--parchment);
}

.upload-prompt svg {
    color: var(--notaire-blue);
    margin-bottom: 1rem;
}

.upload-prompt p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.upload-prompt small {
    color: var(--text-secondary);
}

/* Documents List */
.documents-list {
    margin-top: 2rem;
}

.document-item {
    background: var(--white);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.document-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.document-icon {
    width: 40px;
    height: 40px;
    background: var(--french-clay);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--notaire-blue);
}

.document-details h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.document-details .meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

.btn-icon {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--notaire-blue);
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--parchment);
}

.btn-icon.danger {
    color: var(--warm-red);
}

/* Comments */
.comments-container {
    max-width: 800px;
}

.comments-list {
    margin-bottom: 2rem;
}

.comment-item {
    background: var(--white);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

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

.comment-author {
    font-weight: 600;
    color: var(--deep-ink);
}

.comment-role {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.comment-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.comment-content {
    color: var(--text-primary);
    line-height: 1.6;
}

.comment-form {
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 1rem;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--notaire-blue);
}

/* Activity Timeline */
.activity-timeline {
    max-width: 800px;
}

.activity-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.activity-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 30px;
    bottom: -20px;
    width: 2px;
    background: var(--french-clay);
}

.activity-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--notaire-blue);
    border: 3px solid var(--parchment);
    flex-shrink: 0;
    margin-top: 4px;
}

.activity-content {
    flex: 1;
    background: var(--white);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.activity-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.activity-user {
    font-weight: 600;
    color: var(--deep-ink);
}

.activity-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.activity-action {
    color: var(--text-primary);
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.detail-item {
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.detail-item label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.detail-item p {
    color: var(--text-primary);
    font-size: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--deep-ink);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
}

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

.modal-content form {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--deep-ink);
    color: var(--white);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    z-index: 2000;
    max-width: 400px;
}

.toast.show {
    display: block;
    animation: slideIn 0.3s;
}

.toast.error {
    background: var(--warm-red);
}

.toast.success {
    background: var(--legal-green);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

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

    .tabs {
        overflow-x: auto;
        white-space: nowrap;
    }

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

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