:root {
    --primary-color: #4CAF50;
    /* Fresh Green */
    --primary-light: #C8E6C9;
    /* Very Light Green */
    --primary-dark: #388E3C;
    --text-color: #333;
    --bg-color: #f4f7f6;
    --white: #ffffff;
    --border-color: #e0e0e0;
    --danger: #e74c3c;
    --warning: #f1c40f;
    --success: #2ecc71;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    overflow-y: auto !important;
    /* Force vertical scroll */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling for iOS */
}

/* Login Selection */
.selection-container {
    display: flex;
    gap: 40px;
    text-align: center;
    perspective: 1000px;
    /* 3D effect context */
}

.role-card {
    background: rgba(255, 255, 255, 0.9);
    padding: 50px 30px;
    border-radius: 20px;
    width: 260px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    /* Softer, deeper shadow */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy transition */
    border: 1px solid rgba(255, 255, 255, 0.5);
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    /* Modern glass blur */
}

/* Gradient Background on Hover */
.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: height 0.3s ease;
    z-index: 0;
}

.role-card:hover::before {
    height: 100%;
    opacity: 0.1;
}

.role-card:hover {
    transform: translateY(-15px) scale(1.03);
    box-shadow: 0 20px 40px rgba(76, 175, 80, 0.25);
    border-color: var(--primary-color);
}

.role-card i {
    font-size: 5rem;
    color: #e0e0e0;
    margin-bottom: 25px;
    transition: all 0.3s;
    position: relative;
    z-index: 1;
}

.role-card:hover i {
    color: var(--primary-color);
    transform: scale(1.1);
}

.role-card h3 {
    font-size: 1.6rem;
    color: #444;
    font-weight: 700;
    position: relative;
    z-index: 1;
    letter-spacing: 0.5px;
}

/* Auth Pages (Login) */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-light), var(--white));
    padding: 20px;
}

.login-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    font-size: 2rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    font-weight: bold;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.login-form input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.3s;
    text-align: center;
    display: inline-block;
    text-decoration: none;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

/* Flex helper for action columns */
.actions-flex {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
    white-space: nowrap;
    align-content: center;
    vertical-align: middle;
}

.role-switch {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    background: #f0f0f0;
    padding: 4px;
    border-radius: 30px;
}

.role-switch .switch-btn {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 25px;
    font-weight: 600;
    color: #777;
    transition: all 0.3s;
}

.role-switch .switch-btn.active {
    background: var(--primary-color);
    color: var(--white);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Dashboard Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
    position: fixed;
    height: 100%;
    z-index: 1000;
    overflow-y: auto;
}

.logo-area {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.logo-area h2 {
    color: var(--primary-dark);
    margin: 0;
    font-size: 1.5rem;
}

.nav-links {
    list-style: none;
    padding: 20px 0;
    flex-grow: 1;
}

.nav-links li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #666;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.nav-links li a:hover,
.nav-links li a.active {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-left-color: var(--primary-dark);
}

.nav-links li a i {
    margin-right: 10px;
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 20px;
    transition: margin-left 0.3s;
    min-width: 0;
    overflow-x: hidden;
    /* Prevent horizontal scroll on main-content */
}

/* Responsive Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

/* General Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    background-color: transparent;
}

th,
td {
    padding: 12px 15px;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
    text-align: left !important;
    /* Force left alignment */
}

th {
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
    white-space: nowrap;
}

tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.toggle-sidebar {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-dark);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-img {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-weight: bold;
}

/* Dashboard Cards */
/* Dashboard Cards Responsive Grid */
.stats-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
    /* Default (Mobile): 2 columns */
    grid-template-columns: repeat(2, 1fr);
}

/* Tablet: 3 columns */
@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Desktop: 4 columns */
@media (min-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Ensure equal height */
.stat-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Keep text left, icon right */
    border-bottom: 4px solid var(--primary-color);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    /* Ensure full height in grid */
}

.stat-card::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    z-index: 0;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.stat-info,
.stat-icon {
    position: relative;
    z-index: 1;
}

.stat-info h3 {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 5px;
}

.stat-info p {
    color: #777;
    font-size: 0.9rem;
}

.stat-icon {
    font-size: 2.5rem;
    color: var(--primary-light);
}

/* POS System Styles */
.pos-header {
    background: #2c3e50;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pos-container {
    display: flex;
    height: calc(100vh - 50px);
    overflow: hidden;
}

.pos-left {
    width: 60%;
    background: #f4f7f6;
    padding: 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #ddd;
}

.pos-right {
    width: 40%;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-bar input {
    flex: 1;
    padding: 15px;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: 8px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    overflow-y: auto;
    padding-right: 5px;
}

.product-card {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.1s;
    border: 1px solid transparent;
}

.product-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.p-price-tag {
    color: var(--primary-dark);
    font-weight: bold;
    margin-top: 5px;
}

.p-stock {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}

.cart-header {
    padding: 15px;
    background: #ecf0f1;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f1f1f1;
}

.cart-item:nth-child(even) {
    background: #fafafa;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.qty-btn {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
}

.remove-btn {
    color: #e74c3c;
    cursor: pointer;
    margin-left: 10px;
}

.pos-footer {
    background: #f8f9fa;
    padding: 20px;
    border-top: 2px solid #ddd;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.total-row {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-dark);
    border-top: 1px solid #ccc;
    padding-top: 10px;
    margin-top: 10px;
}

.checkout-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: #fff;
    font-size: 1.3rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}

.checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* =========================================
   New Welcome Screen (Split Layout)
   ========================================= */
/* =========================================
   New Welcome Screen (Split Layout)
   ========================================= */
.no-scroll {
    height: 100%;
}

@media (min-width: 993px) {
    .no-scroll {
        overflow: hidden !important;
    }
}

.welcome-wrapper {
    display: flex;
    height: 100vh;
    background: #fff;
}

/* Left Side: Illustration */
.welcome-visual {
    flex: 1;
    background: #fff;
    /* White background to match image if not transparent */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
}

.visual-img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    /* Removed drop-shadow to look cleaner as per request */
    transition: transform 0.5s ease;
}

.welcome-visual:hover .visual-img {
    transform: scale(1.02);
}

/* Right Side: Controls */
.welcome-controls {
    width: 500px;
    /* Fixed width for controls */
    background: #fff;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.brand-badge {
    text-align: center;
    margin-bottom: 60px;
}

.logo-img {
    width: 120px;
    /* Increased from 120px */
    height: auto;
    margin-bottom: 25px;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.1));
}

.brand-badge h1 {
    font-size: 2.5rem;
    /* Increased from 2.5rem */
    color: #2c3e50;
    margin-bottom: 5px;
    letter-spacing: 2px;
    font-weight: 800;
}

.brand-badge p {
    font-size: 1rem;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 600;
}

/* Control Buttons */
.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.control-btn {
    display: flex;
    align-items: center;
    padding: 20px;
    border-radius: 12px;
    text-decoration: none;
    color: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.control-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s;
}

.control-btn:hover::after {
    transform: translateX(0);
}

.control-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Admin Button Style */
.btn-admin {
    background: linear-gradient(135deg, #4834d4, #686de0);
}

/* Staff Button Style */
.btn-staff {
    background: linear-gradient(135deg, #2c3e50, #4ca1af);
}

.icon-box {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-right: 20px;
}

.text-box {
    display: flex;
    flex-direction: column;
}

.action {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.sub-action {
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-note {
    margin-top: auto;
    color: #bdc3c7;
    font-size: 0.8rem;
    padding-top: 40px;
}

/* Responsive Layout Adjustment */
@media (max-width: 992px) {
    .welcome-wrapper {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
        /* Prevent scroll if it fits */
    }

    .welcome-visual {
        flex: 0 0 auto;
        height: 30vh;
        /* Reduced height */
        padding: 15px 10px 0;
    }

    .visual-img {
        max-height: 100%;
        max-width: 80%;
    }

    .welcome-controls {
        width: 100%;
        flex: 1;
        padding: 10px 20px 20px;
        box-shadow: none;
        justify-content: flex-start;
        /* Start from top to save space */
    }

    .brand-badge {
        margin-bottom: 15px;
        /* Reduced margin */
    }

    .logo-img {
        width: 60px;
        /* Smaller logo */
        margin-bottom: 5px;
    }

    .brand-badge h1 {
        font-size: 1.4rem;
        /* Smaller text */
    }

    .brand-badge p {
        font-size: 0.8rem;
        letter-spacing: 2px;
    }

    .control-buttons {
        gap: 10px;
        /* Tighter gap */
    }

    .control-btn {
        padding: 12px 15px;
        /* Smaller buttons */
    }

    .icon-box {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin-right: 15px;
    }

    .action {
        font-size: 1.1rem;
    }

    .sub-action {
        font-size: 0.75rem;
    }

    .footer-note {
        padding-top: 15px;
        margin-top: auto;
    }

    /* Dashboard Sidebar Mobile */
    .sidebar {
        left: -260px;
        box-shadow: 10px 0 20px rgba(0, 0, 0, 0.1);
        width: 260px;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
    }

    .toggle-sidebar {
        display: block !important;
        cursor: pointer;
        z-index: 1001;
    }

    /* Grid Adjustments */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-info h3 {
        font-size: 1.2rem;
    }

    /* Dashboard Header Mobile Fixes */
    .top-header {
        padding: 10px 15px;
        margin-bottom: 15px;
        flex-wrap: nowrap;
        /* Prevent wrapping */
        gap: 10px;
    }

    .top-header h3 {
        font-size: 0.85rem;
        /* Significantly smaller to fit on one line */
        margin-left: 8px !important;
        white-space: nowrap;
    }

    .user-info {
        gap: 5px;
    }

    .user-info span {
        font-size: 0.8rem;
        /* Smaller user info */
        white-space: nowrap;
    }

    .user-img {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
}