/* assets/css/style.css */
:root {
    /* Primary Color Palette (Deep Premium Blue/Purple) */
    /* --primary-hue: 220; */
    --primary-hue: 250;
    /* More fastidiously premium purple/indigo */
    --primary: hsl(var(--primary-hue), 80%, 50%);
    --primary-dark: hsl(var(--primary-hue), 80%, 40%);
    --primary-light: hsl(var(--primary-hue), 80%, 95%);
    --primary-bg: hsl(var(--primary-hue), 30%, 98%);

    /* Accent Colors */
    --success: hsl(150, 60%, 40%);
    --warning: hsl(35, 90%, 55%);
    --danger: hsl(0, 70%, 55%);
    --info: hsl(200, 70%, 50%);

    /* Neutral Scale */
    --text-main: hsl(220, 20%, 20%);
    --text-muted: hsl(220, 15%, 50%);
    --bg-body: hsl(220, 20%, 97%);
    --bg-card: #ffffff;
    --border: hsl(220, 20%, 90%);

    /* Spacing & Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
    --transition: all 0.3s ease;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 15px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

/* Typography */
h1,
h2,
h3,
h4,
h5 {
    font-weight: 700;
    color: hsl(var(--primary-hue), 60%, 20%);
    letter-spacing: -0.02em;
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

/* Layout Grid */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-item:hover,
.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
}

/* Header */
.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    /* Glass effect could be here */
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Page Content */
.page-content {
    padding: 2rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
    /* Soft shadow for priority */
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-danger {
    background: #fee2e2;
    color: #dc2626;
}

.btn-danger:hover {
    background: #fecaca;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

select.form-control {
    cursor: pointer;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive.no-scroll {
    overflow-x: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.professionals-table {
    table-layout: fixed;
}

.professionals-table th,
.professionals-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Allow wrapping where horizontal scroll is undesired */
.table.table-wrap {
    white-space: normal;
}

.table.table-wrap th,
.table.table-wrap td {
    vertical-align: top;
    word-break: break-word;
}

.professionals-table td:nth-child(6) {
    word-break: break-all;
}

.pagination {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.pagination-actions {
    display: flex;
    gap: 0.5rem;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-input {
    min-width: 220px;
}

/* Professionals card list (mobile) */
.professionals-cards {
    display: none;
    margin-top: 1rem;
    gap: 0.75rem;
}

.professional-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.9rem;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.professional-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.professional-card__name {
    font-weight: 600;
}

.professional-card__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.professional-card__row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-top: 1px dashed var(--border);
}

.professional-card__row:first-of-type {
    border-top: none;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f9fafb;
}

.table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-open {
    background: #e0f2fe;
    color: #0369a1;
}

.status-paid {
    background: #dcfce7;
    color: #15803d;
}

.status-overdue {
    background: #fee2e2;
    color: #b91c1c;
}

.status-active {
    background: #dcfce7;
    color: #15803d;
}

.status-inactive {
    background: #f3f4f6;
    color: #4b5563;
}

/* Utility */
.mb-4 {
    margin-bottom: 1.5rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Utility for forcing two-column layout where desired, still responsive */
.two-cols {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: white;
    width: 90%;
    max-width: 800px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

/* Wizard step styles */
.modal .step {
    display: none;
}

.modal .step.active {
    display: block;
}

.modal .progress {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.modal .progress .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
}

.modal .progress .dot.active {
    background: var(--primary);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
}

/* Reduce padding on small screens so steps fit */
@media (max-height: 700px), (max-width: 520px) {
    .modal {
        padding: 1rem;
        width: 95%;
        max-width: 720px;
    }
    .form-label { font-size: 0.88rem; }
    .form-control { padding: 0.5rem 0.8rem; }
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Mobile Responsiveness */
@media (max-width: 1200px) {
    /* Professionals table -> cards on smaller screens */
    .professionals-table {
        display: none !important;
    }

    .professionals-cards {
        display: grid !important;
    }
}

@media (max-width: 600px) {
    .search-form {
        width: 100%;
    }
    .search-input {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 260px;
        /* Keep same but hide */
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 95;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .top-header {
        padding: 0 1rem;
    }

    #sidebarToggle {
        display: inline-flex !important;
    }

    .page-content {
        padding: 1rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    /* Table tweaks for mobile */
    .table th,
    .table td {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    .status-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Modal full width on mobile */
    .modal {
        width: 95%;
        padding: 1.5rem;
    }


    .flex.justify-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .flex.justify-between button {
        width: 100%;
    }

    .card>form {
        display: flex;
        flex-direction: column;
    }

    .card>form .form-group {
        min-width: 100%;
        margin-bottom: 1rem;
    }

    /* Fix grid inside forms (like date/value) */
    .modal .grid {
        grid-template-columns: 1fr !important;
        gap: 0;
    }
}