:root {
    --primary-color: #c0392b;
    /* Institutional Red */
    --primary-dark: #a93226;
    --secondary-color: #2c3e50;
    /* Graphite */
    --accent-color: #e74c3c;
    --text-color: #333;
    --text-light: #7f8c8d;
    --bg-color: #f4f6f7;
    --white: #ffffff;
    --border-color: #ddd;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #c0392b;
    --sidebar-width: 250px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--secondary-color);
    color: var(--white);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.brand {
    padding: 20px;
    text-align: center;
    background-color: var(--white);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--secondary-color);
}

.brand i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.brand h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--secondary-color);
}

.brand p {
    font-size: 0.8rem;
    color: var(--text-light);
    opacity: 1;
    margin-top: 5px;
}

.sidebar nav {
    flex: 1;
    padding: 20px 0;
}

.nav-btn {
    width: 100%;
    padding: 15px 25px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.nav-btn i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

.nav-btn:hover,
.nav-btn.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--white);
    border-left: 4px solid var(--primary-color);
}

.sidebar-footer {
    padding: 20px;
    font-size: 0.8rem;
    text-align: center;
    opacity: 0.5;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    height: 70px;
    background-color: var(--white);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    z-index: 10;
}

header h2 {
    font-size: 1.4rem;
    color: var(--secondary-color);
}

.user-profile {
    display: flex;
    align-items: center;
    color: var(--secondary-color);
}

.user-profile span {
    margin-right: 10px;
    font-weight: 500;
}

.user-profile i {
    font-size: 2rem;
    color: var(--primary-color);
}

.mobile-only {
    display: none;
}

/* Sections */
.view-section {
    display: none;
    /* Hidden by default */
    padding: 30px;
    overflow-y: auto;
    height: calc(100vh - 70px);
}

.view-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

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

/* Dashboard Cards */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    font-size: 1.5rem;
    color: var(--white);
}

.card-icon.blue {
    background-color: #3498db;
}

.card-icon.red {
    background-color: #e74c3c;
}

.card-icon.green {
    background-color: #2ecc71;
}

.card-info h3 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.card-info p {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--secondary-color);
}

/* Dashboard Charts/Lists */
.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.chart-box {
    background-color: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.chart-box h3 {
    margin-bottom: 20px;
    color: var(--secondary-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.category-list p {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f9f9f9;
}

.category-list p span:last-child {
    font-weight: 700;
    color: var(--secondary-color);
}

/* Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background-color: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    align-items: center;
}

.search-box {
    flex: 1;
    position: relative;
    min-width: 200px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

.search-box input {
    width: 100%;
    padding: 10px 10px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.filter-box select {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--white);
    cursor: pointer;
}

/* Tables */
.table-container {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

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

table th,
table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background-color: #f8f9fa;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
}

table tr:hover {
    background-color: #fcfcfc;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-ok {
    background-color: #e8f8f5;
    color: #27ae60;
}

.status-low {
    background-color: #fdedec;
    color: #c0392b;
}

.action-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1rem;
    margin-right: 10px;
    color: var(--text-light);
    transition: color 0.2s;
}

.action-btn:hover {
    color: var(--secondary-color);
}

.action-btn.edit:hover {
    color: var(--primary-color);
}

.action-btn.delete:hover {
    color: #c0392b;
}

.action-btn.move:hover {
    color: #f39c12;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

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

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

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

.btn-secondary:hover {
    background-color: #1a252f;
}

.btn-text {
    background: none;
    color: var(--text-light);
}

.btn-text:hover {
    color: var(--text-color);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--white);
    padding: 30px;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal.open .modal-content {
    transform: translateY(0);
}

.modal-content.small-modal {
    width: 400px;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.close-modal:hover {
    color: #333;
}

.modal h2 {
    margin-bottom: 20px;
    color: var(--secondary-color);
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color);
}

input,
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.modal-footer {
    margin-top: 25px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Toggle Switch for Movement */
.toggle-switch {
    display: flex;
    background-color: #f0f0f0;
    border-radius: 4px;
    padding: 4px;
    margin-bottom: 20px;
}

.toggle-switch input {
    display: none;
}

.toggle-opt {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.2s;
}

input#mov-in:checked+.toggle-opt.in {
    background-color: var(--success-color);
    color: var(--white);
}

input#mov-out:checked+.toggle-opt.out {
    background-color: var(--danger-color);
    color: var(--white);
}

.highlight-text {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

/* Reports section styling */
.report-panel {
    background-color: var(--white);
    padding: 40px;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
}

.report-panel h3 {
    margin-bottom: 15px;
}

.report-panel p {
    margin-bottom: 30px;
    color: var(--text-light);
}

/* Icon Buttons (Backup/Restore) */
.btn-icon {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    color: var(--secondary-color);
    transition: all 0.2s;
}

.btn-icon:hover {
    background-color: var(--secondary-color);
    color: var(--white);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -250px;
        height: 100%;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    /* Overlay when sidebar is active */
    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 250px;
        /* Width of sidebar */
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .view-section {
        padding: 15px;
        /* Reduce padding on mobile */
    }

    .mobile-only {
        display: block;
        background: none;
        border: none;
        font-size: 1.2rem;
        cursor: pointer;
        color: var(--secondary-color);
    }

    header {
        padding: 0 15px;
    }

    .user-profile span {
        display: none;
        /* Hide name on mobile to save space */
    }

    .cards-container {
        grid-template-columns: 1fr;
        /* Stack cards */
    }

    .dashboard-charts {
        grid-template-columns: 1fr;
    }

    /* Table Responsive */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table th,
    table td {
        white-space: nowrap;
        /* Prevent wrapping in cells */
        padding: 10px;
        font-size: 0.9rem;
    }

    /* Toolbar Stacking */
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box,
    .filter-box,
    .toolbar button {
        width: 100%;
    }

    /* Modals on Mobile */
    .modal-content {
        width: 95%;
        margin: 10px;
        /* Ensure some spacing */
        padding: 20px;
        max-height: 90vh;
        /* Prevent overflowing screen height */
        overflow-y: auto;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .modal-footer {
        flex-direction: column-reverse;
        /* Stack buttons, cancel at bottom usually or check design */
        gap: 10px;
    }

    .modal-footer button {
        width: 100%;
    }
}

@media (max-width: 480px) {

    /* Extra improvements for very small screens */
    .card {
        padding: 15px;
    }

    .card-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .card-info p {
        font-size: 1.5rem;
    }

    header h2 {
        font-size: 1.1rem;
    }
}

/* Login Screen Styles */
.login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #1a252f 100%);
}

.login-box {
    background-color: var(--white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 400px;
    max-width: 90%;
    text-align: center;
}

.login-header {
    margin-bottom: 30px;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 1.8rem;
    color: var(--secondary-color);
}

.login-header p {
    color: var(--text-light);
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.input-with-icon input {
    padding-left: 40px;
}

.login-btn {
    width: 100%;
    justify-content: center;
    margin-top: 10px;
    padding: 12px;
    font-size: 1rem;
}

.error-msg {
    color: var(--danger-color);
    margin-top: 15px;
    font-size: 0.9rem;
    min-height: 20px;
}

/* Logo Styles */
.brand-logo {
    max-width: 120px;
    /* Adjusted for sidebar */
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    display: block;
    margin: 0 auto;
}

.brand-logo-large {
    max-width: 150px;
    /* Adjusted for login screen */
    height: auto;
    margin-bottom: 20px;
}