@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&family=Fira+Code:wght@400;500;600&display=swap');

:root {
    --bg-main: #060913;
    --bg-card: #0d1222;
    --bg-card-hover: #141b32;
    --border-color: #17203b;
    --border-hover: #263560;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #06b6d4;
    --accent-hover: #0891b2;
    --success: #10b981;
    --success-hover: #059669;
    --warning: #f59e0b;
    --warning-hover: #d97706;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --glow-primary: rgba(37, 99, 235, 0.15);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: 'Outfit', sans-serif;
    --font-mono: 'Fira Code', 'Consolas', monospace;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

h1, h2, h3, h4, h5, h6, .logo-text, .login-title, .modal-title, .card-title {
    font-family: var(--font-display);
    font-weight: 700;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(6, 182, 212, 0.2); }
    50% { box-shadow: 0 0 25px rgba(6, 182, 212, 0.4); }
}

@keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); } /* very slight floating animation as requested */
}

@keyframes bgMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes goldShine {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* Premium Gold Text Styling */
.gold-shine-text {
    background: linear-gradient(90deg, #d4af37, #f3e5ab, #d4af37, #aa7c11, #d4af37);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: goldShine 3s linear infinite;
    font-weight: 800;
}

/* Navigation & Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-text {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    font-family: var(--font-display) !important;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.menu-item a:hover, .menu-item.active a {
    color: var(--text-primary);
    background-color: var(--bg-card-hover);
}

.menu-item.active a {
    border-left: 3px solid var(--warning);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.08) 0%, rgba(18, 24, 38, 0) 100%);
}

.user-profile-section {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-width: 140px;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-logout:hover {
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.1);
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.mobile-menu-toggle {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
}

/* Stats Row */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.primary::before { background-color: var(--primary); }
.stat-card.accent::before { background-color: var(--accent); }
.stat-card.success::before { background-color: var(--success); }
.stat-card.warning::before { background-color: var(--warning); }

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
}

.stat-value.cyan {
    color: var(--accent);
}

/* Grid Layouts */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards & Sections */
.panel-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Forms & Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
    pointer-events: none; /* Allows tapping through the icon to focus the input */
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-icon svg, svg.input-icon {
    width: 18px !important;
    height: 18px !important;
}

input[type="text"].input-with-icon, 
input[type="password"].input-with-icon,
input[type="number"].input-with-icon,
input[type="date"].input-with-icon,
.input-with-icon {
    padding-left: 2.8rem !important;
}

input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    background-color: rgba(6, 9, 19, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

input[type="checkbox"] {
    width: auto;
    height: auto;
    cursor: pointer;
    accent-color: var(--primary);
}

input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus, input[type="date"]:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--glow-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    width: 100%;
}

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

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

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

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

.btn-warning {
    background-color: var(--warning);
    color: #000;
}

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

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

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

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

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

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

.password-input-group {
    display: flex;
    gap: 0.5rem;
}
.password-input-group input {
    flex-grow: 1;
}
.password-input-group button {
    width: auto;
    white-space: nowrap;
}

/* Account Details list */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-val {
    font-size: 1.05rem;
    font-weight: 500;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

th {
    background-color: rgba(13, 18, 34, 0.6);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

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

tr:hover td {
    background-color: rgba(20, 27, 50, 0.4);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-approved {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-rejected {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* License Key text copyable styling */
.license-key-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    max-width: 250px;
}

.license-key-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-copy-key {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.btn-copy-key:hover {
    color: var(--accent-hover);
}

/* Login Screen */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(-45deg, #060913, #0b1120, #0f172a, #0b1120);
    background-size: 400% 400%;
    animation: bgMove 12s ease infinite;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 20px rgba(37, 99, 235, 0.05);
    animation: fadeIn 0.4s ease;
}

.login-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.login-logo img {
    animation: floatLogo 3s ease-in-out infinite;
}

.login-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    font-family: var(--font-display) !important;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background-color: var(--bg-card);
    border-left: 4px solid var(--primary);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 1rem 1.25rem;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 400px;
    animation: fadeIn 0.25s ease-out;
}

.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.danger { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--accent); }

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.75rem;
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

/* Custom price line items styling */
.custom-price-item {
    display: grid;
    grid-template-columns: 1fr 120px;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}
.custom-price-item:last-child {
    border-bottom: none;
}
.custom-price-item-name {
    font-size: 0.88rem;
    font-weight: 500;
}

/* System Settings Card specific */
.system-title-section {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}
.system-title-section .form-group {
    flex-grow: 1;
}
.system-title-section button {
    width: auto;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(6, 9, 19, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive sidebar & mobile optimizations */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        font-size: 0.85rem; /* Scales general font size down */
    }
    
    /* Completely hide page title (Overview/Dashboard) on mobile top left */
    .page-title, #active-page-title {
        display: none !important;
    }
    
    .sidebar {
        position: fixed !important;
        transform: translateX(-100%) !important;
        width: 260px !important;
        z-index: 100 !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6) !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        height: -webkit-fill-available !important;
        overflow-y: auto !important; /* Scrollable mobile drawer menu */
        -webkit-overflow-scrolling: touch !important;
    }
    .sidebar.active {
        transform: translateX(0) !important;
    }
    .main-content {
        margin-left: 0;
        padding: 0.75rem;
        padding-top: 4.75rem; /* Adjusted for condensed floating header */
        gap: 1rem;
    }
    
    .top-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 58px;
        background-color: rgba(11, 17, 32, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--border-color);
        padding: 0.5rem 0.75rem;
        margin-bottom: 0;
        z-index: 90;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(30, 41, 59, 0.6);
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        width: 40px;
        height: 40px;
        border-radius: 8px;
        cursor: pointer;
        padding: 0;
    }
    .mobile-menu-toggle svg {
        width: 20px !important;
        height: 20px !important;
    }
    
    input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
        font-size: 16px !important; /* Prevents auto-zoom in mobile Safari */
        padding: 0.85rem 1rem !important; /* Thicker/bold bar padding */
        border: 2px solid var(--border-color) !important; /* Thicker border outline */
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
        gap: 0.25rem;
    }
    .stat-value {
        font-size: 1.5rem;
    }
    
    .panel-card {
        padding: 1rem;
        gap: 1rem;
    }
    .card-header {
        padding-bottom: 0.5rem;
    }
    .card-title {
        font-size: 0.95rem;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    .custom-price-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 0.6rem 0.7rem;
    }
    
    .license-key-copy {
        max-width: 120px;
        font-size: 0.7rem;
        padding: 0.2rem 0.35rem;
    }
    
    /* Login refinements for mobile */
    .login-card {
        padding: 2rem 1.5rem;
        margin: 1rem;
        max-width: 90%;
    }
    
    .login-title {
        font-size: 1.7rem;
    }
}
