/* modern.css - Portagest Modern UI System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #EEF2FF;
    --sidebar-bg: #0F172A;
    --sidebar-hover: #1E293B;
    --sidebar-active: #1E293B;
    --sidebar-text: #94A3B8;
    --sidebar-text-hover: #F8FAFC;
    --bg-app: #F8FAFC;
    --bg-card: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --radius: 12px;
    --sidebar-width: 280px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
}

.sidebar-header img {
    height: 64px;
    filter: brightness(0) invert(1);
}

.sidebar-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 0 0.75rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none !important;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text-hover);
}

.nav-item.active {
    background-color: var(--sidebar-active);
    color: var(--sidebar-text-hover);
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--sidebar-hover);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    width: calc(100% - var(--sidebar-width));
}

/* Header / Top Bar (Optional if integrated in layout) */
.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 2rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Common Components */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons Overrides */
.btn {
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary, .btn-nuevo {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

.btn-primary:hover, .btn-nuevo:hover {
    background-color: var(--primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

/* Table Modernization */
.table-responsive {
    border-radius: var(--radius);
    overflow-x: auto;
    border: 1px solid var(--border-color);
    background: white;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: transparent;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: #f8fafc;
}

/* Forms Modernization */
input[type="text"], input[type="email"], input[type="password"], select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #fcfcfc;
    transition: all 0.2s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(215, 38, 56, 0.1);
    background: white;
}

/* Specific Dashboard adjustments */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.kpi {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    text-align: left;
}

.kpi .lbl {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.kpi .val {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
}

/* Reset existing .wrap if present */
.wrap {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* FullCalendar Modernization */
#calendario {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
}

.fc .fc-toolbar-title {
    color: var(--text-main);
    font-weight: 800;
    font-size: 1.25rem;
}

.fc .fc-button-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.fc .fc-button-primary:hover {
    background-color: var(--primary-dark);
}

.fc .fc-timegrid-slot {
    height: 60px !important;
}

.fc .fc-timegrid-axis-frame {
    height: 60px !important;
}

.fc .fc-timegrid-event {
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: none !important;
}

.fc .fc-event-main {
    padding: 4px 8px !important;
}

.pc-ev {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pc-ev-time {
    font-size: 0.7rem;
    font-weight: 700;
    opacity: 0.9;
}

.pc-ev-title {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Tiles and Menus */
.btn-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none !important;
    transition: all 0.2s ease;
    min-height: 120px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.btn-tile i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.btn-tile:hover {
    background-color: var(--primary);
    color: white !important;
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.btn-tile span {
    font-size: 1.1rem;
    display: block;
}

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

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

/* Semantics Badges */
.badge-pending {
    background-color: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}
.badge-paid {
    background-color: #DCFCE7;
    color: #166534;
    border: 1px solid #BBF7D0;
}
.badge-urgent {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* Secondary Button Support */
.btn-secondary-soft {
    background-color: #F1F5F9;
    color: #334155;
    border: 1px solid #E2E8F0;
}
.btn-secondary-soft:hover {
    background-color: #E2E8F0;
    color: #0F172A;
}

/* Page Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title h2 {
    font-weight: 800;
    margin: 0;
    color: var(--text-main);
    font-size: 1.75rem;
}

.page-title p {
    margin: 0;
    color: var(--text-muted);
}

@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    .main-content {
        margin-left: 220px;
        width: calc(100% - 220px);
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .app-container {
        display: block;
    }
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        top: auto;
        bottom: auto;
        overflow: visible;
    }
    .sidebar-header {
        padding: 1rem;
        justify-content: center;
    }
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        padding: 0.5rem 1rem;
        -webkit-overflow-scrolling: touch;
    }
    .nav-item {
        flex-direction: row;
        margin-right: 0.5rem;
        margin-bottom: 0;
        padding: 0.5rem 1rem;
    }
    .nav-item.active {
        border-left: none;
        border-bottom: 3px solid var(--primary);
        border-radius: 8px 8px 0 0;
    }
    .sidebar-footer {
        display: none;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }
    .top-bar {
        justify-content: space-between;
    }
    .top-bar .user-profile {
        margin-left: auto;
    }
}
