:root {
    --primary: #1a2a44;
    --primary-light: #2c4161;
    --accent: #c5a059;
    --bg-main: #f8f9fa;
    --bg-card: #ffffff;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --border: #dfe6e9;
    --success: #27ae60;
    --danger: #d63031;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --radius: 8px;
}

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

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

h1,
h2,
h3 {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background-color: var(--primary);
    color: white;
    padding: 1.2rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.navbar h1 {
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    flex-shrink: 0;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background-color: #bfa04a;
    transform: translateY(-2px);
}

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

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

.btn-outline-light {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: 0.85rem;
    padding: 8px 15px;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: 4px;
}

/* Main Content Views */
#main-content {
    margin-top: 2rem;
    padding-bottom: 4rem;
}

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

.tabs {
    display: flex;
    gap: 10px;
    background: #eee;
    padding: 5px;
    border-radius: var(--radius);
}

.tab-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: calc(var(--radius) - 2px);
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Cards & Lists */
.card-list {
    display: grid;
    gap: 1rem;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 5px solid var(--primary);
    transition: transform 0.2s ease;
    display: flex;
    overflow: hidden;
}

.card:hover {
    transform: scale(1.01);
}

.card-body {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.card-delete-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    background: #fff5f5;
    border-left: 1px solid #fee2e2;
}

.btn-delete {
    background: var(--danger);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-delete:hover {
    background: #b91c1c;
}

.card-info h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
}

.card-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.lawsuit-card .card-info h3 {
    margin: 5px 0;
}

.exp-text {
    font-weight: 500;
    color: var(--primary-light);
    background: #f1f3f7;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-top: 5px;
}

.client-name-meta {
    font-size: 0.85rem;
    color: var(--accent);
    margin-top: 4px;
}

.card-status-zone {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.badge-status-pill {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-blue {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-brown {
    background: #fef3c7;
    color: #92400e;
}

/* Using yellow variant for brown feel */
.badge-yellow {
    background: #fef9c3;
    color: #854d0e;
}

.badge-green {
    background: #dcfce7;
    color: #166534;
}

.badge-status {
    background: #f1f2f6;
    color: var(--primary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius);
    padding: 2rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

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

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 2rem;
}

/* Detail View */
.detail-section {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.info-item label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.info-item p {
    font-weight: 600;
    font-size: 1.1rem;
}

.history-item {
    border-left: 2px solid var(--accent);
    padding-left: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.history-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 0;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-comment {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-main);
}

/* Utilities */
.hidden {
    display: none !important;
}

.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0;
}

.tag {
    background: #f1f2f6;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.btn-danger-filled {
    background-color: var(--danger);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.btn-danger-filled:hover {
    background-color: #b91c1c;
}

.input-group {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

/* Calendar Styles */
.calendar-container {
    background: white;
    padding: 0.8rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
}

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

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

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

.day-head {
    text-align: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding-bottom: 3px;
}

.day-cell {
    background: #f8f9fa;
    min-height: 45px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.day-cell:hover {
    background: #e9ecef;
}

.day-cell.selected {
    border-color: var(--accent);
    background: #fffbeb;
}

.day-cell.empty {
    background: transparent;
    cursor: default;
}

.day-number {
    font-weight: 600;
    font-size: 0.8rem;
}

.day-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    margin-top: 2px;
}

.dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
}

.dot-blue {
    background-color: #3b82f6;
}

/* Mercantil, Amparo, Apelación */
.dot-brown {
    background-color: #78350f;
}

/* Familiar */
.dot-yellow {
    background-color: #eab308;
}

/* Civil */
.dot-green {
    background-color: #22c55e;
}

/* Sucesorio */

.selected-hearings-box {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border);
}

.selected-hearings-box h4 {
    margin-bottom: 1rem;
}

.card.border-blue {
    border-left-color: #3b82f6;
}

.card.border-brown {
    border-left-color: #78350f;
}

.card.border-yellow {
    border-left-color: #22c55e;
}

/* Responsiveness */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .nav-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

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

    .view-header .tabs {
        width: 100%;
        overflow-x: auto;
    }

    .card-body {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .card-status-zone {
        align-items: flex-start;
        width: 100%;
        border-top: 1px solid var(--border);
        padding-top: 1rem;
    }

    .card-status-zone .icon {
        display: none;
        /* Hide icon on mobile to save space */
    }

    .modal {
        padding: 1.2rem;
        width: 95%;
    }

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

    .input-group {
        flex-direction: column;
        gap: 10px;
    }

    .input-group button {
        width: 100%;
    }

    .card-delete-zone {
        padding: 0 0.8rem;
    }

    .btn-delete {
        width: 25px;
        height: 25px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .navbar h1 {
        font-size: 1.5rem;
    }

    .calendar-container {
        padding: 0.5rem;
    }

    .day-cell {
        min-height: 40px;
        padding: 2px;
    }

    .day-number {
        font-size: 0.75rem;
    }
}

/* Document Management */
.document-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 1rem;
}

.doc-card {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.doc-icon {
    font-size: 2rem;
    margin-bottom: 5px;
    display: block;
}

.doc-name {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.btn-primary input[type="file"] {
    display: none;
}