﻿/* =========================================
   VARIABLES & RESET
   ========================================= */
:root {
    --brand-orange: #ff6b35;
    --brand-orange-hover: #e85a28;
    --brand-dark: #2c3e50;
    --brand-gray: #7f8c8d;
    --brand-bg: #eef2f6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', sans-serif;
}

/* =========================================
   LOGIN PAGE LAYOUT
   ========================================= */
body.login-layout {
    background-color: var(--brand-bg);
    min-height: 100vh; /* Use min-height instead of height */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px; /* Adds breathing room */
    overflow-y: auto; /* Allows scrolling if screen is too small */
}

.login-container {
    display: flex;
    width: 100%;
    max-width: 1000px;
    height: 600px; /* Fixed height for consistency */
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: auto; /* Forces it to center */
}

.left-panel {
    width: 45%;
    height: 100%;
    background-color: var(--brand-orange);
}

    .left-panel img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.right-panel {
    width: 55%;
    height: 100%;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px 50px;
}

/* Mobile Adjustments */
@media (max-width: 900px) {
    .login-container {
        flex-direction: column;
        height: auto; /* Let height adjust for mobile */
        max-height: none;
    }

    .left-panel {
        height: 250px;
        width: 100%;
    }

    .right-panel {
        width: 100%;
        padding: 30px 20px;
    }
}

.form-wrapper {
    width: 100%;
    max-width: 420px;
}

.logo-area {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
}

    .logo-area img {
        height: 45px;
        margin-right: 15px;
    }

    .logo-area h2 {
        color: var(--brand-dark);
        font-size: 1.6rem;
        font-weight: 800;
        letter-spacing: 1px;
    }

/* Form Controls */
.form-group {
    margin-bottom: 16px;
    position: relative;
}

    .form-group label {
        display: block;
        font-size: 0.85rem;
        color: var(--brand-gray);
        margin-bottom: 6px;
        font-weight: 600;
    }

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dce1e6;
    border-radius: 8px;
    font-size: 13px;
    background-color: #f9fbfd;
    transition: all 0.3s;
}

    .form-control:focus {
        border-color: var(--brand-orange);
        outline: none;
        background-color: white;
        box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.1);
    }

.input-icon {
    position: relative;
}

    .input-icon > i {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: #95a5a6;
    }

    .input-icon .form-control {
        padding-left: 40px;
        padding-right: 40px;
    }

.eye-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #95a5a6;
    cursor: pointer;
    z-index: 10;
    width: 20px;
    text-align: center;
}

.remember-me {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--brand-gray);
    margin-bottom: 20px;
    cursor: pointer;
}

.remember-me input {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: var(--brand-orange);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--brand-orange);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-primary:hover {
    background: var(--brand-orange-hover);
}

.footer-text {
    text-align: center;
    margin-top: 25px;
    font-size: 0.75rem;
    color: #95a5a6;
    line-height: 1.5;
}

/* =========================================
   DASHBOARD / APP LAYOUT
   ========================================= */
body.app-layout {
    background-color: var(--brand-bg);
    height: 100vh;
    overflow: hidden;
}

.topbar {
    height: 70px;
    background-color: var(--brand-dark);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 3px solid var(--brand-orange);
}

.logo-area-top {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 20px;
}

    .logo-area-top img {
        height: 35px;
    }

.nav-items {
    display: flex;
    gap: 10px;
    flex: 1;
    margin-left: 30px;
    overflow-x: auto;
}

.nav-btn {
    color: #bdc3c7;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: 0.2s;
}

    .nav-btn:hover, .nav-btn.active {
        background-color: var(--brand-orange);
        color: white;
    }

    .nav-btn i {
        font-size: 18px;
        margin-bottom: 4px;
    }

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
}

.logout-btn {
    color: #e74c3c;
    text-decoration: none;
    font-size: 18px;
}

.app-body {
    display: flex;
    height: calc(100vh - 70px);
}

/* =========================================
   SIDEBAR (Normal & Collapsed)
   ========================================= */
.sidebar {
    width: 250px;
    min-width: 250px;
    background-color: white;
    border-right: 1px solid #dce1e6;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: width 0.3s ease, min-width 0.3s ease;
    overflow-x: hidden;
}

    /* When collapsed */
    .sidebar.collapsed {
        width: 70px;
        min-width: 70px;
    }

        /* Hide the headers completely when collapsed */
        .sidebar.collapsed .sidebar-header,
        .sidebar.collapsed .sidebar-group {
            display: none;
        }

/* Target the links */
.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-left: 4px solid transparent;
    transition: 0.2s;
    white-space: nowrap; /* Prevents text wrapping */
}

    .sidebar-menu li a:hover, .sidebar-menu li a.active {
        background-color: #f0f4f8;
        color: var(--brand-orange);
        border-left-color: var(--brand-orange);
    }

    .sidebar-menu li a i {
        width: 20px;
        text-align: center;
        font-size: 1.2rem;
    }

/* ★ THE MAGIC TRICK FOR COLLAPSED TEXT ★ */
.sidebar.collapsed .sidebar-menu li a {
    justify-content: center;
    padding: 15px 0;
    font-size: 0; /* Hides the raw text completely */
}

    .sidebar.collapsed .sidebar-menu li a i {
        margin-right: 0;
        font-size: 1.2rem; /* Keeps the icon size normal */
    }

.sidebar-header {
    padding: 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dce1e6;
}

    .sidebar-header h3 {
        color: var(--brand-dark);
        font-size: 16px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px; /* Reduced from 15px */
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-left: 4px solid transparent;
    transition: 0.2s;
}

.sidebar-group {
    padding: 15px 20px 5px 20px; /* More compact group headers */
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #95a5a6;
    letter-spacing: 1px;
}

.sidebar-menu li a:hover, .sidebar-menu li a.active {
    background-color: #f0f4f8;
    color: var(--brand-orange);
    border-left-color: var(--brand-orange);
}

.sidebar-menu li a i {
    width: 20px;
    text-align: center;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.dash-card {
    background: white;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-decoration: none;
    color: var(--brand-dark);
    transition: 0.2s;
    border: 1px solid #e1e8ed;
}

    .dash-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 25px rgba(0,0,0,0.1);
        border-color: var(--brand-orange);
    }

    .dash-card i {
        font-size: 45px;
        margin-bottom: 15px;
        color: var(--brand-orange);
    }

    .dash-card h4 {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }

    .dash-card p {
        font-size: 0.85rem;
        color: var(--brand-gray);
    }

/* Mobile */
@media (max-width: 900px) {
    .login-container {
        flex-direction: column;
        height: 95vh;
        width: 95vw;
        overflow-y: auto;
    }

    .left-panel {
        height: 220px;
        width: 100% !important;
        flex-shrink: 0;
    }

        .left-panel img {
            object-fit: contain;
            padding: 10px;
        }

    .right-panel {
        width: 100% !important;
        padding: 30px 20px;
        justify-content: flex-start;
        overflow-y: auto;
    }
}
/* Dense Table for ERP */
.erp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem; /* Reduced from 0.85rem for a tighter grid */
}

    .erp-table th {
        padding: 6px 10px; /* Reduced from 8px 12px */
        text-align: left;
        background: #f8f9fa;
        border-bottom: 2px solid var(--brand-orange);
        font-weight: 600;
        color: var(--brand-dark);
        position: sticky;
        top: 0;
        z-index: 1;
        font-size: 0.75rem;
    }

    .erp-table td {
        padding: 6px 10px; /* Reduced from 8px 12px */
        border-bottom: 1px solid #eee;
        color: #333;
        font-size: 0.75rem;
    }

    .erp-table tr:hover td {
        background-color: #fdfbf7;
        cursor: pointer;
    }

/* Compact Form Row for ERP Data Entry */
.form-row-compact {
    display: flex;
    align-items: center;
    margin-bottom: 6px; /* Tighter vertical spacing */
}

    .form-row-compact label {
        width: 110px; /* Fixed width for all labels */
        min-width: 110px;
        margin-bottom: 0;
        font-size: 0.8rem;
        color: var(--brand-dark);
        font-weight: 600;
        text-align: left;
    }

    .form-row-compact .form-control {
        padding: 4px 8px; /* Much tighter input padding */
        height: 30px; /* Smaller height */
        font-size: 0.85rem;
    }
/* Split Row for side-by-side inputs */
.form-row-split {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
}

    .form-row-split .form-row-compact {
        flex: 1;
        margin-bottom: 0;
    }

        .form-row-split .form-row-compact label {
            width: 60px; /* Smaller label width for split fields */
            min-width: 60px;
        }