/**
 * I-Damiral's Smart Inventory & Raw Material Management System
 * Custom Modern Red & White Theme Stylesheet
 */

:root {
    --primary-red: #c81e1e;
    --primary-red-hover: #b91c1c;
    --dark-red: #991b1b;
    --light-red: #fee2e2;
    --accent-red: #ef4444;
    --pure-white: #ffffff;
    --bg-light: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --sidebar-width: 260px;
    --topbar-height: 70px;
    --card-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
    --card-hover-shadow: 0 8px 24px rgba(200, 30, 30, 0.12);
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* -------------------------------------------------------------
   Layout Structure
------------------------------------------------------------- */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

#sidebar .sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    color: #ffffff;
    text-decoration: none;
}

#sidebar .sidebar-brand .logo-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#sidebar .sidebar-menu {
    padding: 1.25rem 0.85rem;
    flex-grow: 1;
    overflow-y: auto;
}

.menu-header {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding: 0.75rem 0.75rem 0.35rem;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    padding: 0.7rem 0.85rem;
    color: #475569;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.92rem;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.nav-link-custom i {
    font-size: 1.1rem;
    width: 28px;
    color: #64748b;
    transition: color 0.2s;
}

.nav-link-custom:hover {
    background-color: var(--light-red);
    color: var(--primary-red);
}

.nav-link-custom:hover i {
    color: var(--primary-red);
}

.nav-link-custom.active {
    background: linear-gradient(135deg, var(--primary-red) 0%, #b91c1c 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(200, 30, 30, 0.25);
}

.nav-link-custom.active i {
    color: #ffffff;
}

/* User pill in sidebar */
.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: #fafafa;
}

/* Main Content Area */
#content-wrapper {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.3s;
}

/* Topbar */
#topbar {
    height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.25em 0.55em;
    border-radius: 999px;
    border: 2px solid #ffffff;
}

/* Notification Bell Animation */
.bell-ringing {
    animation: ring 1.5s infinite ease-in-out;
    transform-origin: top center;
}

@keyframes ring {
    0% { transform: rotate(0); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-15deg); }
    30% { transform: rotate(10deg); }
    40% { transform: rotate(-10deg); }
    50% { transform: rotate(0); }
    100% { transform: rotate(0); }
}

/* -------------------------------------------------------------
   Dashboard Cards & Widgets
------------------------------------------------------------- */
.card-damiral {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

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

.stat-card {
    position: relative;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card.stat-red {
    border-left: 4px solid var(--primary-red);
}
.stat-card.stat-red .stat-icon {
    background: var(--light-red);
    color: var(--primary-red);
}

.stat-card.stat-amber {
    border-left: 4px solid #f59e0b;
}
.stat-card.stat-amber .stat-icon {
    background: #fef3c7;
    color: #d97706;
}

.stat-card.stat-blue {
    border-left: 4px solid #2563eb;
}
.stat-card.stat-blue .stat-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.stat-card.stat-emerald {
    border-left: 4px solid #10b981;
}
.stat-card.stat-emerald .stat-icon {
    background: #d1fae5;
    color: #059669;
}

.stat-card .stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

/* -------------------------------------------------------------
   Buttons & Action Styles
------------------------------------------------------------- */
.btn-damirals {
    background: linear-gradient(135deg, var(--primary-red) 0%, #b91c1c 100%);
    color: #ffffff;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    padding: 0.65rem 1.4rem;
    box-shadow: 0 4px 12px rgba(200, 30, 30, 0.25);
    transition: all 0.2s;
}

.btn-damirals:hover, .btn-damirals:focus {
    background: linear-gradient(135deg, #b91c1c 0%, var(--dark-red) 100%);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(200, 30, 30, 0.35);
}

.btn-outline-damirals {
    border: 1.5px solid var(--primary-red);
    color: var(--primary-red);
    font-weight: 600;
    border-radius: 10px;
    padding: 0.65rem 1.4rem;
    background: transparent;
    transition: all 0.2s;
}

.btn-outline-damirals:hover {
    background: var(--primary-red);
    color: #ffffff;
}

/* -------------------------------------------------------------
   Tables & DataTables Custom Styling
------------------------------------------------------------- */
.table-custom {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom thead th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color);
    padding: 0.9rem 1rem;
}

.table-custom tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.92rem;
}

.table-custom tbody tr:hover {
    background-color: #fdf2f2;
}

/* Badges */
.badge-batch {
    font-family: monospace;
    font-size: 0.85rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

/* -------------------------------------------------------------
   QR & Barcode Scanner View
------------------------------------------------------------- */
.scanner-viewport {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    border: 3px solid var(--primary-red);
    box-shadow: 0 8px 30px rgba(200, 30, 30, 0.2);
    position: relative;
    background: #000000;
}

.scan-laser {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #ef4444;
    box-shadow: 0 0 12px #ef4444;
    animation: scanAnim 2s infinite ease-in-out;
}

@keyframes scanAnim {
    0% { top: 5%; opacity: 0.8; }
    50% { top: 90%; opacity: 1; }
    100% { top: 5%; opacity: 0.8; }
}

/* -------------------------------------------------------------
   Printable Label Design
------------------------------------------------------------- */
@media print {
    body * {
        visibility: hidden;
    }
    #print-label-area, #print-label-area * {
        visibility: visible;
    }
    #print-label-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .no-print {
        display: none !important;
    }
}

.printable-label {
    width: 380px;
    border: 2px solid #000;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    font-family: Arial, sans-serif;
    margin: 10px auto;
}

.printable-label .label-header {
    border-bottom: 2px solid #000;
    padding-bottom: 8px;
    margin-bottom: 10px;
    text-align: center;
}

/* -------------------------------------------------------------
   Responsive Breakpoints
------------------------------------------------------------- */
@media (max-width: 991.98px) {
    #sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    #sidebar.show {
        margin-left: 0;
    }
    #content-wrapper {
        margin-left: 0;
    }
}
