/* Goodas – global layout, navbar, glass cards, tables (MarchanHub / promptccs).
 *
 * Responsive tiers (patentarestilo/promptccs):
 *   Mobile:       (max-width: 575.98px)
 *   Tablet:       (min-width: 576px) and (max-width: 991.98px)
 *   Desktop:      (min-width: 992px) and (max-width: 1199.98px)
 *   Extra-large:  (min-width: 1200px)
 * Navbar: ≤768px logo static (no absolute center); ≤575.98px logo 48px; ≤480px logo 42px.
 */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
    --font-primary: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    --primary-color: #0ea5e9;
    --primary-hover: #0284c7;
    --primary-light: #e0f2fe;
    --primary-rgb: 14, 165, 233;
    --secondary-color: #f1f5f9;

    --text-color: #0f172a;
    --text-muted: #64748b;
    --text-light: #fff;

    --bg-white: #fff;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;
    --border-light: #cbd5e1;
    --border-focus: #38bdf8;

    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;

    --border-radius: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.12);

    --navbar-height: 72px;
    --navbar-logo-scale: 2.5;
    --navbar-logo-slot: calc(var(--navbar-height) - 1rem);

    --glass-bg: rgba(255, 255, 255, 0.18);
    --glass-border: rgba(255, 255, 255, 0.35);
    --glass-blur: 24px;
    --glass-input-bg: rgba(255, 255, 255, 0.25);
    --glass-input-border: rgba(255, 255, 255, 0.45);
    --glass-input-blur: 12px;
    --glass-card-bg: rgba(255, 255, 255, 0.25);
    --glass-card-header-bg: rgba(248, 249, 250, 0.5);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-primary);
    color: var(--text-color);
    line-height: 1.6;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Background shapes – all panel screens */
.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-shapes .shape {
    position: absolute;
    background: rgba(var(--primary-rgb), 0.06);
    border: 1px solid rgba(var(--primary-rgb), 0.1);
    animation: float-shapes 6s ease-in-out infinite;
    box-shadow: 0 8px 32px rgba(var(--primary-rgb), 0.08);
}

.bg-shapes .shape:nth-child(1) {
    width: 80px;
    height: 55px;
    border-radius: 12px;
    top: 15%;
    left: 8%;
    animation-delay: 0s;
    --start-rotation: 15deg;
    transform: rotate(15deg);
}

.bg-shapes .shape:nth-child(2) {
    width: 60px;
    height: 95px;
    border-radius: 10px;
    top: 55%;
    right: 10%;
    left: auto;
    animation-delay: 2s;
    --start-rotation: -20deg;
    transform: rotate(-20deg);
}

.bg-shapes .shape:nth-child(3) {
    width: 70px;
    height: 45px;
    border-radius: 8px;
    bottom: 25%;
    left: 15%;
    animation-delay: 4s;
    --start-rotation: 25deg;
    transform: rotate(25deg);
}

.bg-shapes .shape:nth-child(4) {
    width: 55px;
    height: 85px;
    border-radius: 8px;
    top: 8%;
    right: 25%;
    left: auto;
    animation-delay: 1s;
    --start-rotation: -10deg;
    transform: rotate(-10deg);
}

.bg-shapes .shape:nth-child(5) {
    width: 75px;
    height: 50px;
    border-radius: 10px;
    bottom: 35%;
    right: 15%;
    left: auto;
    animation-delay: 3s;
    --start-rotation: 30deg;
    transform: rotate(30deg);
}

.bg-shapes .shape:nth-child(6) {
    width: 65px;
    height: 65px;
    border-radius: 14px;
    top: 38%;
    left: 5%;
    animation-delay: 5s;
    --start-rotation: -15deg;
    transform: rotate(-15deg);
}

@keyframes float-shapes {
    0%,
    100% {
        transform: translateY(0) rotate(var(--start-rotation, 0deg));
    }
    50% {
        transform: translateY(-20px) rotate(calc(var(--start-rotation, 0deg) + 180deg));
    }
}

.navbar {
    background-color: #fff;
    box-shadow: var(--shadow);
    padding: calc(0.5rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right))
        calc(0.5rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left));
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    min-height: var(--navbar-height);
}

.navbar .container-fluid {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
}

.navbar-brand {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    height: var(--navbar-logo-slot);
    width: min(14rem, 38vw);
    overflow: hidden;
}

.navbar .navbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand img.navbar-logo {
    height: var(--navbar-logo-slot);
    width: auto;
    max-width: none;
    object-fit: contain;
    object-position: center center;
    vertical-align: middle;
    transform: scale(var(--navbar-logo-scale));
    transform-origin: center center;
}

.user-welcome {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
    flex-wrap: wrap;
}

.user-welcome .user-name--link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-welcome .user-name--link:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.user-welcome .user-name--link:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
    border-radius: 2px;
}

.badge-role {
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.8rem;
}

.main-container {
    padding-top: calc(var(--navbar-height) + env(safe-area-inset-top));
}

.card {
    background: var(--glass-card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    transition: var(--transition);
    margin-bottom: 2rem;
}

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

.card-header {
    background: var(--glass-card-header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.card-body {
    padding: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: var(--glass-card-header-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.25);
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.75rem;
    text-align: left;
    vertical-align: middle;
}

.table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.2);
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
    color: var(--text-muted);
}

.table th:last-child,
.table td:last-child {
    white-space: nowrap;
    width: 1%;
    min-width: 130px;
    text-align: center;
}

.table a {
    color: var(--primary-color);
    text-decoration: none;
}

.table a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.table a:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    :root {
        --navbar-height: 68px;
        --navbar-logo-scale: 2.35;
    }

    .navbar .container-fluid {
        justify-content: space-between;
        gap: 0.5rem;
    }

    .navbar-brand {
        position: static;
        transform: none;
        flex-shrink: 0;
        order: 1;
        margin-left: 0.5rem;
        width: min(9.5rem, 34vw);
    }

    .navbar .navbar-actions {
        margin-left: auto;
        order: 2;
        flex: 0 1 auto;
        min-width: 0;
        justify-content: flex-end;
    }

    .user-welcome {
        flex: 0 1 auto;
        min-width: 0;
        flex-wrap: nowrap;
    }

    .user-welcome .user-name,
    .user-welcome .user-name--link {
        flex: 0 1 auto;
        min-width: 0;
        max-width: min(11rem, 34vw);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .badge-role {
        font-size: 0.65rem;
        flex-shrink: 0;
    }

    .navbar-actions > .btn-light {
        flex-shrink: 0;
    }
}

@media (max-width: 575.98px) {
    :root {
        --navbar-height: 64px;
        --navbar-logo-scale: 2.2;
    }

    .navbar-brand {
        width: min(8.5rem, 32vw);
    }

    .user-welcome > .fa-user-circle {
        display: none;
    }
}

@media (max-width: 480px) {
    :root {
        --navbar-height: 60px;
        --navbar-logo-scale: 2.1;
    }

    .navbar-brand {
        width: min(7.5rem, 30vw);
    }

    .navbar-actions > .btn-light {
        font-size: 0;
        padding: 0.375rem 0.55rem;
    }

    .navbar-actions > .btn-light i {
        font-size: 0.875rem;
    }
}

/* Mobile + tablet: stacked table cards and collapsible filtros (tier max tablet). */
@media (max-width: 991.98px) {
    .table-mobile-cards {
        overflow-x: visible;
    }

    .table-mobile-cards table {
        display: block;
    }

    .table-mobile-cards table thead {
        display: none;
    }

    .table-mobile-cards table tbody {
        display: block;
    }

    .table-mobile-cards table tbody tr:not(.mobile-expand-row) {
        display: block;
        margin-bottom: 1rem;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.5);
        backdrop-filter: blur(var(--glass-blur));
        -webkit-backdrop-filter: blur(var(--glass-blur));
        border: 1px solid var(--glass-border);
        border-radius: var(--border-radius);
        box-shadow: var(--shadow);
        border-left: 4px solid var(--primary-color);
    }

    .table-mobile-cards table tbody tr:not(.mobile-expand-row) > td {
        display: block;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
        font-size: 0.9rem;
    }

    .table-mobile-cards table tbody tr:not(.mobile-expand-row) > td:last-child {
        border-bottom: none;
        padding-top: 0.75rem;
    }

    .table-mobile-cards table tbody tr:not(.mobile-expand-row) > td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }

    .table-mobile-cards table tbody tr:not(.mobile-expand-row) > td a {
        display: inline-block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .table-mobile-cards table tbody tr td[colspan] {
        text-align: center;
        padding: 1.5rem;
    }

    .table-mobile-cards table tbody tr td[colspan]::before {
        content: none;
    }

    .filtros-container .filtros-toggle-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
        padding: 0.75rem 1rem;
        margin-bottom: 0;
        background: var(--primary-color);
        color: var(--text-light);
        border: none;
        border-radius: var(--border-radius);
        font-weight: 500;
        font-size: 0.95rem;
        cursor: pointer;
        transition: var(--transition);
        font-family: var(--font-primary);
    }

    .filtros-container .filtros-toggle-mobile:hover {
        background: var(--primary-hover);
    }

    .filtros-container .filtros-toggle-mobile .fa-chevron-down {
        transition: transform 0.3s ease;
        margin-left: 0.25rem;
    }

    .filtros-container.filtros-expandido .filtros-toggle-mobile .fa-chevron-down {
        transform: rotate(180deg);
    }

    .filtros-container .filtros-inner {
        display: none;
        padding-top: 1rem;
        border-top: 1px solid var(--border-light);
        margin-top: 0.5rem;
    }

    .filtros-container.filtros-expandido .filtros-inner {
        display: block;
    }
}

@media (min-width: 992px) {
    .filtros-container .filtros-toggle-mobile {
        display: none;
    }

    .filtros-container .filtros-inner {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    .bg-shapes .shape {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
