@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,100..900;1,100..900&display=swap');

/* VAS Web App Styles */
:root {
    /* Core Web App Palette: Red, Grey, White */
    --primary: #e11d48;
    --primary-hover: #be123c;
    --primary-soft: #fff1f2;
    --primary-glow: rgba(225, 29, 72, 0.1);

    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --text-main: #1e293b;
    --text-muted: #64748b;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --radius-md: 12px;
    --radius-lg: 16px;
    --max-width: 1400px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto Condensed', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
}

/* --- Layout Structure --- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 64px;
}

.header-container {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 20px;
}

.main-content {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 100px 24px;
    min-height: calc(100vh - 64px);
}

/* --- Navigation & Header Components --- */
.header-branding {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
    padding: 0 20px;
}

.user-space {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 4px 4px 14px;
    background: var(--slate-50);
    border-radius: 99px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.user-name {
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--slate-900);
}

.user-role-badge {
    font-size: 0.625rem;
    color: var(--slate-500);
    font-weight: 800;
    text-transform: uppercase;
    background: white;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8125rem;
    color: white;
}

.logout-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: white;
    border: 1px solid var(--slate-200);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #fee2e2;
    border-color: #fecaca;
    transform: translateY(-1px);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 99px;
    color: var(--slate-600);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-item:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.nav-item.active {
    color: var(--primary);
    background: var(--primary-soft);
}

.nav-item i {
    font-size: 1rem;
    opacity: 0.7;
}

.user-pill:hover {
    background: var(--slate-100);
    border-color: var(--slate-300);
    cursor: pointer;
}

.mobile-hide {
    display: flex;
}

@media (max-width: 1024px) {
    .mobile-hide {
        display: none;
    }
}

/* --- UI Components --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--slate-700);
    border-color: var(--slate-200);
}

.btn-secondary:hover {
    background: var(--slate-50);
}

/* --- Responsive Grids --- */
.grid {
    display: grid;
    gap: 24px;
}

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

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* --- Mobile / Tablet Adaptability --- */
@media (max-width: 1024px) {
    .header-nav {
        display: none;
    }

    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .flex-between {
        flex-direction: column;
        align-items: stretch !important;
        gap: 20px;
    }

    .flex-between>div {
        text-align: center;
    }

    .flex-between>div[style*="flex-wrap"],
    .flex-between>div.flex {
        justify-content: center !important;
    }
}

@media (max-width: 768px) {

    .grid-cols-4,
    .grid-cols-3,
    .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    .main-content {
        padding: 24px 12px 100px 12px;
    }

    .header-container {
        padding: 0 16px;
    }

    .card {
        padding: 16px !important;
    }

    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        height: 64px;
        border-top: 1px solid var(--border);
        justify-content: space-around;
        align-items: center;
        z-index: 2005;
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
    }

    .breadcrumb-wrap {
        flex-wrap: wrap;
        gap: 4px !important;
    }

    .modal-overlay {
        padding: 10px !important;
    }

    .modal-container {
        width: 100% !important;
        max-height: 98vh !important;
    }

    /* Table Fixes */
    .table-container {
        margin: 0 -12px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    td,
    td,
    th {
        padding: 10px !important;
        font-size: 0.8rem !important;
    }

    /* Stack inner-modal grids */
    .modal-body div[style*="grid"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
}

.mobile-nav {
    display: none;
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--slate-400);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 700;
}

.mobile-nav-link i {
    font-size: 1.25rem;
}

.mobile-nav-link.active {
    color: var(--primary);
}

/* --- Forms --- */
.form-group,
.input-group {
    margin-bottom: 20px;
}

.label,
.input-label {
    display: block;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--slate-700);
    margin-bottom: 6px;
}

.input,
.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--slate-200);
    background: white;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

.input:focus,
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* --- Status Badges --- */
.badge {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

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

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

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

.badge-info {
    background: #e0f2fe;
    color: #075985;
}

/* --- Tables --- */
.table-wrap,
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: var(--slate-50);
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--slate-500);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--slate-700);
}

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

/* --- Animations --- */
.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    align-items: flex-start;
    /* Anchor to top for long content */
    justify-content: center;
    z-index: 2000;
    padding: 40px 16px;
    /* More vertical breathing room */
    overflow-y: auto;
    /* Allow scrolling of the overlay */
}

.modal,
.modal-container {
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    background: var(--slate-50);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.125rem;
    color: var(--slate-900);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    /* test */
    padding: 16px 24px;
    background: var(--slate-50);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* --- Sliding Drawer Navigation --- */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    display: block;
    opacity: 1;
}

.app-drawer {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100%;
    background: white;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.1);
    z-index: 3001;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.drawer-overlay.active+.app-drawer {
    transform: translateX(320px);
}

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

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.drawer-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--slate-600);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.drawer-item:hover {
    background: var(--slate-50);
    color: var(--primary);
}

.drawer-item.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.drawer-item i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.8;
}

.drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--slate-50);
    color: var(--slate-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.drawer-close:hover {
    background: #fee2e2;
    color: var(--danger);
}

/* --- Material Catalog Premium Styles --- */
.folder-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.folder-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--primary);
}

.folder-icon-wrapper {
    height: 160px;
    background: var(--slate-50);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.3s ease;
}

.folder-card:hover .folder-icon-wrapper {
    background: var(--primary-soft);
}

.folder-card:hover .folder-icon-wrapper i {
    color: var(--primary);
    transform: scale(1.1);
}

.folder-icon-wrapper i {
    font-size: 3rem;
    color: var(--slate-300);
    transition: all 0.3s ease;
}

.material-glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.search-bar-wrap {
    background: white;
    border-radius: 99px;
    padding: 6px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.search-bar-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.search-bar-wrap input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.9375rem;
    color: var(--slate-700);
    background: transparent;
}

.price-tag {
    color: var(--slate-900);
    font-weight: 800;
    font-size: 1.25rem;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.price-tag span {
    font-size: 0.8rem;
    color: var(--slate-400);
    font-weight: 600;
}

.cat-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 2;
}