/* ==========================================================
   KEMET GOLD MINING – UNIFIED OFFICIAL UI THEME
   Clean Merge Version – Production Ready
========================================================== */

/* ==========================================================
   🎨 THEME VARIABLES
========================================================== */
:root {

    /* Backgrounds */
    --bg-main: #0f0c08;
    --bg-secondary: #1a120a;
    --bg-tertiary: #2b1d10;

    /* Gold */
    --gold-light: #ffd77a;
    --gold-medium: #c9a24d;
    --gold-dark: #a88a45;

    /* Text */
    --text-main: #f5e6b8;
    --text-muted: #b8a46a;
    --text-balance: #276dae;

    /* Borders */
    --border-color: #5e4a25;

    /* Status */
    --danger: #c0392b;
    --success: #27ae60;

    --shadow-gold: rgba(255, 200, 90, 0.25);
}

/* 🌞 LIGHT MODE – Professional Version */
body.light-mode {

    --bg-main: #f4f1ec;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f9f6f1;

    --gold-light: #c9a24d;
    --gold-medium: #a88a45;
    --gold-dark: #7a642e;

    --text-main: #2b1d10;
    --text-muted: #6e5b3a;

    --border-color: #e3d6bd;

    background: linear-gradient(180deg,#f4f1ec,#f9f6f1);
}

/* ==========================================================
   RESET
========================================================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    background: radial-gradient(ellipse at top, #3a2a1a, var(--bg-main));
    color: var(--text-main);
    transition: 0.3s ease;
}

/* ==========================================================
   LAYOUT
========================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.page-content {
    padding: 25px;
    animation: fadeIn .4s ease;
}

@keyframes fadeIn {
    from {opacity:0; transform: translateY(8px);}
    to {opacity:1; transform: translateY(0);}
}

/* ==========================================================
   SIDEBAR
========================================================== */
.sidebar {
    width: 270px;
    background: linear-gradient(180deg, var(--bg-tertiary), var(--bg-secondary));
    border-left: 2px solid var(--border-color);
    padding: 20px 15px;
    overflow-y: auto;
    transition: 0.3s ease;
}

.sidebar.collapsed { width: 80px; }

.sidebar .logo {
    text-align: center;
    margin-bottom: 25px;
}

.sidebar .logo img { max-width: 200px; }

.menu { list-style: none; padding: 0; margin: 0; }

.menu-group { margin-bottom: 8px; }

/* Toggle */
.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
}

.menu-toggle span {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.menu-toggle i {
    font-size: 15px;
}

.menu-toggle:hover {
    background: rgba(255,215,122,.08);
    transform: translateX(-4px);
}

/* Arrow */
.menu-group .arrow {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.menu-group.open .arrow {
    transform: rotate(180deg);
}

/* Submenu */
.menu-group .submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.menu-group.open .submenu {
    max-height: 500px;
}

.submenu a {
    display: block;
    padding: 10px 25px;
    text-decoration: none;
    color: var(--text-main);
    border-radius: 8px;
    transition: 0.3s;
}

.submenu-title {
    padding: 10px 25px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: bold;
    opacity: .7;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

.submenu a:hover {
    background: rgba(255,215,122,.1);
    color: var(--gold-light);
}

/* عناصر مفردة في السيدبار */
.menu-group.single-item .menu-toggle {
    justify-content: flex-start;
}

.menu-group.single-item .menu-toggle span {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-group.single-item a {
    text-decoration: none;
    color: var(--text-main);
}

/* ==========================================================
   TOPBAR – SaaS Premium Style
========================================================== */

.topbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 18px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--gold-medium);
}

/* User Menu */
.top-menu {
    position: relative;
}

.top-menu button {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 12px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: 0.3s;
}

.top-menu button:hover {
    background: rgba(255,215,122,.1);
    border-color: var(--gold-light);
}

/* Dropdown */
.top-menu ul {
    position: absolute;
    top: 120%;
    left: 0;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    list-style: none;
    padding: 10px;
    margin: 0;
    display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 9999;
}

.top-menu.open ul {
    display: block;
}

.top-menu ul li a,
.top-menu ul li button {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-main);
    background: transparent;
    border: none;
    text-align: right;
    cursor: pointer;
}

.top-menu ul li a:hover,
.top-menu ul li button:hover {
    background: rgba(255,215,122,.1);
    color: var(--gold-medium);
}

/* ==========================================================
   CARDS
========================================================== */
.card {
    background: linear-gradient(145deg,var(--bg-tertiary),var(--bg-secondary));
    border: 2px solid var(--border-color);
    border-radius: 18px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 0 25px var(--shadow-gold);
}

/* ==========================================================
   BUTTONS
========================================================== */
.btn {
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(145deg,var(--gold-light),var(--gold-medium));
    color: var(--bg-secondary);
    font-weight: bold;
    cursor: pointer;
    transition: .3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-gold);
}

/* Small Buttons */
.btn-sm {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255,215,122,.08);
    color: var(--gold-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: .3s;
}

.btn-sm:hover {
    background: var(--gold-medium);
    color: var(--bg-main);
}

/* ==========================================================
   FORMS
========================================================== */
.form-group { margin-bottom: 18px; }

label {
    display: block;
    margin-bottom: 6px;
    color: var(--gold-medium);
    font-size: 14px;
}

input, textarea, select {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-main);
    font-family: 'Cairo', sans-serif;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--gold-light);
    box-shadow: 0 0 10px rgba(255,215,122,.3);
}

/* ==========================================================
   TABLES
========================================================== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.table th { color: var(--gold-medium); }

.table tr:hover {
    background: rgba(255,215,122,.05);
}

/* ==========================================================
   BADGES
========================================================== */
.badge {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
}

.badge.success {
    background: rgba(39,174,96,.2);
    color: #2ecc71;
}

.badge.danger {
    background: rgba(192,57,43,.2);
    color: #ff6b6b;
}

/* ==========================================================
   PAGE HEADER
========================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h2 {
    margin: 0;
    color: var(--gold-medium);
}

.balance-number {
    color: var(--text-balance);
    font-weight: bold;
}

/* ==========================================================
   RESPONSIVE
========================================================== */
@media (max-width: 992px){

    .sidebar{
        position: fixed;
        top: 0;
        right: -270px;
        bottom: 0;
        width: 270px;
        height: 100vh;
        z-index: 9999;
        transition: right 0.3s ease;
    }

    .sidebar.mobile-open{
        right: 0;
    }

}

.sidebar-overlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    opacity: 0;
    visibility: hidden;
    transition: .3s;
    z-index: 9998;
}

.sidebar-overlay.active{
    opacity: 1;
    visibility: visible;
}

body.no-scroll{
    overflow: hidden;
}

/* ==========================================================
   ALERTS
========================================================== */
.alert {
    padding: 15px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    font-weight: 600;
}

.alert-danger {
    background: rgba(192,57,43,.15);
    color: #ff6b6b;
    border-color: var(--danger);
}

.alert-success {
    background: rgba(39,174,96,.15);
    color: #2ecc71;
    border-color: var(--success);
}