/* =====================================================================
   RLS Admin - main stylesheet
   Sections: base, animations, topbar, sidebar, content, cards, utilities,
   buttons, tables, forms, badges, dashboard, customers, customer form,
   customer profile, email template, auth, flash, mobile, responsive
   ===================================================================== */

/* ---------- 1. Base ---------- */
:root{
    --brand:#ff1744;
    --brand2:#a9002d;
    --ink:#17191e;
    --muted:#777b85;
    --line:#e8eaf0;
    --soft:#f4f5f9;
    --dark:#0d0f14;

    --grad-brand:linear-gradient(135deg,#ff1744,#a9002d);
    --grad-blue:linear-gradient(135deg,#3b82f6,#6366f1);
    --grad-green:linear-gradient(135deg,#10b981,#059669);
    --grad-amber:linear-gradient(135deg,#f59e0b,#ef6c00);
    --grad-purple:linear-gradient(135deg,#a855f7,#6d28d9);
    --grad-teal:linear-gradient(135deg,#06b6d4,#0e7490);
}

*{ box-sizing:border-box; }

html{ font-size:13px; }
@media(min-width:1600px){ html{ font-size:14px; } }

body{
    margin:0;
    font-family:'Inter',ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
    font-size:1rem;
    color:var(--ink);
    -webkit-font-smoothing:antialiased;
    background:
        radial-gradient(circle at 100% 0%,#ffe3ea 0,transparent 28%),
        radial-gradient(circle at 0% 100%,#e6e9ff 0,transparent 26%),
        var(--soft);
    background-attachment:fixed;
}

.muted{ color:var(--muted); }
.mini,.eyebrow{ font-size:9px; letter-spacing:.13em; font-weight:850; color:#92959e; text-transform:uppercase; }

/* ---------- 2. Animations ---------- */
@keyframes fadeUp{ from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:none} }
@keyframes fadeIn{ from{opacity:0} to{opacity:1} }
@keyframes gradShift{ 0%{background-position:0% 50%} 50%{background-position:100% 50%} 100%{background-position:0% 50%} }
@keyframes pulseRing{ 0%{box-shadow:0 0 0 0 rgba(255,23,68,.55)} 70%{box-shadow:0 0 0 10px rgba(255,23,68,0)} 100%{box-shadow:0 0 0 0 rgba(255,23,68,0)} }
@keyframes floaty{ 0%,100%{transform:translateY(0)} 50%{transform:translateY(-12px)} }

.fade-up{ opacity:0; animation:fadeUp .55s cubic-bezier(.2,.7,.2,1) forwards; animation-delay:var(--d,0s); }

.content > .page-head,
.content > .card,
.content > .row,
.content > form{ animation:fadeUp .5s cubic-bezier(.2,.7,.2,1) both; }

/* ---------- 3. Topbar ---------- */
.topbar{
    height:54px;
    position:sticky; top:0; z-index:1050;
    color:#fff;
    background:linear-gradient(115deg,#090b0f,#1c1220,#2a0d18,#1a1d25);
    background-size:300% 300%;
    animation:gradShift 14s ease infinite;
    box-shadow:0 8px 28px #11122055;
    border-bottom:1px solid rgba(255,255,255,.06);
}
.brand{ color:#fff; text-decoration:none; font-weight:850; letter-spacing:.02em; }
.brand:hover{ color:#fff; }
.brandmark{
    width:30px; height:30px; border-radius:10px; font-size:14px;
    display:grid; place-items:center;
    background:var(--grad-brand);
    animation:pulseRing 2.6s infinite;
}

/* ---------- 4. Shell + Sidebar ---------- */
.shell{ display:flex; min-height:calc(100vh - 54px); }

.sidebar{
    width:220px; flex-shrink:0;
    position:sticky; top:54px; height:calc(100vh - 54px);
    padding:8px 10px 18px;
    overflow-y:auto;
    background:linear-gradient(180deg,#0d0f14 0%,#1a0f18 55%,#2b0b17 100%);
    scrollbar-width:thin; scrollbar-color:#3a2a33 transparent;
}

.side-title{ font-size:9px; font-weight:850; letter-spacing:.15em; color:#6f6a76; margin:12px 8px 4px; }

.navlink{
    position:relative; overflow:hidden;
    display:flex; align-items:center; gap:9px;
    margin:1px 0; padding:7px 10px;
    font-size:12.5px; font-weight:650;
    color:#b9b6c2; text-decoration:none;
    border-radius:9px;
    transition:all .22s ease;
}
.navlink i{ width:16px; font-size:14px; transition:transform .25s ease; }
.navlink:hover{ color:#fff; background:rgba(255,255,255,.07); transform:translateX(4px); }
.navlink:hover i{ transform:scale(1.18) rotate(-4deg); }
.navlink.active{ color:#fff; background:var(--grad-brand); box-shadow:0 8px 22px rgba(255,23,68,.35); }
.navlink.active::before{ content:""; position:absolute; left:0; top:20%; bottom:20%; width:3px; border-radius:3px; background:#fff; }

/* ---------- 5. Content ---------- */
.content{ flex:1; min-width:0; padding:16px 18px; }

.page-head{ display:flex; justify-content:space-between; align-items:center; gap:14px; margin-bottom:12px; }
.page-head h1{ font-size:21px; font-weight:850; letter-spacing:-.03em; margin:0; }

/* ---------- 6. Cards ---------- */
.card{
    border:1px solid rgba(232,234,240,.9);
    border-radius:14px;
    background:rgba(255,255,255,.93);
    backdrop-filter:blur(6px);
    box-shadow:0 8px 28px #16191f0d;
    transition:transform .25s ease, box-shadow .25s ease;
}
.card:hover{ box-shadow:0 14px 38px #16191f16; }
.card-head{ padding:10px 14px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; gap:10px; }
.card-body{ padding:14px; }

.stat-card{ position:relative; overflow:hidden; padding:12px 14px; }
.stat-card::before{ content:""; position:absolute; inset:0 0 auto 0; height:3px; background:var(--bar,var(--grad-brand)); }
.stat-card:hover{ transform:translateY(-4px); }
.stat-icon{
    width:34px; height:34px; border-radius:10px; font-size:15px;
    display:grid; place-items:center; color:#fff;
    box-shadow:0 6px 14px #0002;
    transition:transform .3s ease;
}
.stat-card:hover .stat-icon{ transform:rotate(-8deg) scale(1.1); }
.stat-num{ font-size:20px; font-weight:850; letter-spacing:-.04em; margin-top:6px; }

.s-brand{ --bar:var(--grad-brand); } .s-blue{ --bar:var(--grad-blue); } .s-green{ --bar:var(--grad-green); }
.s-amber{ --bar:var(--grad-amber); } .s-purple{ --bar:var(--grad-purple); } .s-teal{ --bar:var(--grad-teal); }

/* ---------- 7. Gradient utilities ---------- */
.g-brand{ background:var(--grad-brand); } .g-blue{ background:var(--grad-blue); } .g-green{ background:var(--grad-green); }
.g-amber{ background:var(--grad-amber); } .g-purple{ background:var(--grad-purple); } .g-teal{ background:var(--grad-teal); }

/* ---------- 8. Buttons ---------- */
.btn{ font-size:12px; font-weight:750; padding:.38rem .8rem; border-radius:9px; transition:all .22s ease; }
.btn-sm{ font-size:11.5px; padding:.28rem .6rem; }
.btn:hover{ transform:translateY(-2px); }
.btn-brand{
    background:linear-gradient(135deg,#ff1744,#a9002d,#ff1744); background-size:200% 200%;
    border:0; color:#fff; box-shadow:0 8px 18px #ff174430;
}
.btn-brand:hover{ color:#fff; background-position:100% 0; box-shadow:0 12px 26px #ff174450; }

/* ---------- 9. Tables ---------- */
.table{ font-size:12px; margin:0; }
.table th{ font-size:9.5px; padding:.5rem .65rem; text-transform:uppercase; letter-spacing:.07em; color:#858995; background:#fafbfd; white-space:nowrap; }
.table td{ padding:.5rem .65rem; vertical-align:middle; }
.table tbody tr{ transition:background .18s ease; }
.table tbody tr:hover{ background:#fff5f7; }
.table-wrap{ overflow:auto; }
.empty{ padding:36px; text-align:center; color:var(--muted); }

/* ---------- 10. Forms ---------- */
.form-label{ font-size:11.5px; font-weight:750; margin-bottom:.25rem; }
.form-control,.form-select{
    font-size:12.5px; min-height:34px; padding:.35rem .7rem;
    border-radius:9px; border-color:#dfe2e8; transition:all .2s ease;
}
.form-control:focus,.form-select:focus{ border-color:#ff8195; box-shadow:0 0 0 .2rem #ff17441a; }
.form-check-input:checked{ background-color:var(--brand); border-color:var(--brand); }

/* ---------- 11. Badges ---------- */
.badge{ font-size:9.5px; padding:.45em .7em; border-radius:20px; }
.sbadge{ display:inline-flex; align-items:center; gap:5px; font-size:10.5px; font-weight:700; padding:3px 8px; border-radius:20px; text-transform:capitalize; }
.sbadge.ok{ background:#e7f8f1; color:#0a8f63; }
.sbadge.warn{ background:#fff4e0; color:#c27803; }
.sbadge.bad{ background:#feebee; color:#d32f4a; }
.sbadge.none{ background:#f0f1f5; color:#6b7080; }

/* ---------- 12. Avatars ---------- */
.avatar{
    width:38px; height:38px; border-radius:11px; font-size:15px; font-weight:850;
    display:grid; place-items:center; flex-shrink:0; color:#fff; background:var(--grad-brand);
}
.av{ width:32px; height:32px; border-radius:10px; font-size:12px; font-weight:800; display:grid; place-items:center; flex-shrink:0; color:#fff; }
.av-0{ background:var(--grad-brand); } .av-1{ background:var(--grad-blue); } .av-2{ background:var(--grad-green); }
.av-3{ background:var(--grad-purple); } .av-4{ background:var(--grad-amber); }

/* ---------- 13. Dashboard ---------- */
.hero{
    position:relative; overflow:hidden; color:#fff;
    padding:18px 20px; border-radius:16px;
    background:linear-gradient(120deg,#0c0f14,#2a0d18 45%,#a9002d 80%,#ff1744); background-size:200% 200%;
    box-shadow:0 18px 45px #a9002d33;
    animation:gradShift 12s ease infinite, fadeUp .6s ease both;
}
.hero::before,.hero::after{ content:""; position:absolute; border-radius:50%; background:rgba(255,255,255,.08); animation:floaty 7s ease-in-out infinite; }
.hero::before{ width:200px; height:200px; right:-50px; top:-70px; }
.hero::after{ width:120px; height:120px; right:150px; bottom:-55px; animation-delay:-3s; }
.hero h1{ font-size:21px; font-weight:850; letter-spacing:-.03em; margin:3px 0 4px; }
.hero .eyebrow{ color:rgba(255,255,255,.65); }
.hero p{ color:rgba(255,255,255,.75); margin:0; }
.btn-glass{ background:rgba(255,255,255,.14); color:#fff; border:1px solid rgba(255,255,255,.25); backdrop-filter:blur(6px); }
.btn-glass:hover{ background:rgba(255,255,255,.25); color:#fff; }
.btn-white{ background:#fff; color:#a9002d; border:0; }

.qa{
    display:flex; align-items:center; gap:10px; padding:10px 12px;
    color:var(--ink); text-decoration:none;
    background:#fff; border:1px solid var(--line); border-radius:12px;
    transition:all .25s ease;
}
.qa i{ width:34px; height:34px; border-radius:10px; font-size:15px; display:grid; place-items:center; color:#fff; transition:transform .3s ease; }
.qa small{ display:block; color:var(--muted); font-size:11px; }
.qa:hover{ transform:translateY(-4px); box-shadow:0 14px 30px #16191f1a; color:var(--ink); }
.qa:hover i{ transform:rotate(-10deg) scale(1.12); }

.chart-box{ position:relative; height:210px; }

.user-row{ border-radius:12px; transition:background .2s ease, transform .2s ease; }
.user-row:hover{ background:#fff5f7; transform:translateX(4px); }

/* ---------- 14. Customers list ---------- */
.mstat{ display:flex; align-items:center; gap:10px; padding:10px 12px; }
.mstat .ico{ width:34px; height:34px; border-radius:10px; font-size:15px; display:grid; place-items:center; color:#fff; }
.mstat .num{ font-size:18px; font-weight:800; line-height:1; letter-spacing:-.03em; }
.mstat .lbl{ font-size:10.5px; color:var(--muted); font-weight:600; margin-top:3px; }

.search-wrap{ position:relative; flex-grow:1; }
.search-wrap i{ position:absolute; left:12px; top:50%; transform:translateY(-50%); color:#9a9da5; }
.search-wrap input{ padding-left:34px; }

/* ---------- 15. Customer form ---------- */
.section-title{ display:flex; align-items:center; gap:9px; font-weight:800; font-size:14px; margin-bottom:3px; }
.section-title i{ width:30px; height:30px; border-radius:9px; font-size:14px; display:grid; place-items:center; color:#fff; background:var(--grad-brand); }

.input-icon{ position:relative; }
.input-icon > i.lead{ position:absolute; left:12px; top:50%; transform:translateY(-50%); color:#9a9da5; pointer-events:none; }
.input-icon .form-control{ padding-left:34px; }
.pw-toggle{ position:absolute; right:6px; top:50%; transform:translateY(-50%); border:0; background:transparent; color:#777b85; padding:4px 8px; }

.opt{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 12px; border:1px solid var(--line); border-radius:11px; background:#fafbfd; }
.opt strong{ display:block; font-size:12.5px; }
.opt small{ color:var(--muted); font-size:11px; }
.form-switch .form-check-input{ width:2.6em; height:1.4em; cursor:pointer; }

/* ---------- 16. Customer profile ---------- */
.u-hero{
    position:relative; overflow:hidden; color:#fff;
    padding:16px 18px; border-radius:16px;
    background:linear-gradient(120deg,#0c0f14,#2a0d18 50%,#a9002d 85%,#ff1744); background-size:200% 200%;
    box-shadow:0 18px 45px #a9002d30;
    animation:gradShift 12s ease infinite;
}
.u-hero::after{ content:""; position:absolute; width:200px; height:200px; right:-60px; top:-80px; border-radius:50%; background:rgba(255,255,255,.08); animation:floaty 7s ease-in-out infinite; }
.u-hero .avatar{ width:48px; height:48px; font-size:20px; border-radius:14px; background:rgba(255,255,255,.18); border:1px solid rgba(255,255,255,.3); }
.u-hero h2{ font-size:19px; letter-spacing:-.02em; }
.u-hero .eyebrow{ color:rgba(255,255,255,.65); }
.u-hero .meta{ color:rgba(255,255,255,.75); font-size:12px; }
.hero-chip{ display:inline-flex; align-items:center; gap:5px; font-size:10.5px; font-weight:700; padding:3px 9px; border-radius:20px; background:rgba(255,255,255,.16); border:1px solid rgba(255,255,255,.22); }

.pro-tabs{
    display:flex; gap:5px; padding:4px; overflow-x:auto; white-space:nowrap; scrollbar-width:none;
    background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:0 6px 20px #16191f0a;
}
.pro-tabs::-webkit-scrollbar{ display:none; }
.pro-tabs .nav-link{ display:flex; align-items:center; gap:6px; padding:7px 12px; font-size:12px; font-weight:700; color:#5d616c; border-radius:9px; transition:all .2s ease; }
.pro-tabs .nav-link:hover{ background:#fff3f5; color:var(--brand); }
.pro-tabs .nav-link.active{ background:var(--grad-brand); color:#fff; box-shadow:0 8px 18px #ff174433; }
.pro-tabs .cnt{ font-size:10px; font-weight:800; padding:1px 6px; border-radius:20px; background:#eef0f4; color:#5d616c; }
.pro-tabs .nav-link.active .cnt{ background:rgba(255,255,255,.25); color:#fff; }
.tab-pane.show{ animation:fadeUp .4s ease both; }

.ov-card{ position:relative; overflow:hidden; padding:12px 14px; }
.ov-card:hover{ transform:translateY(-4px); }
.ov-card .ico{ width:34px; height:34px; border-radius:10px; font-size:15px; margin-bottom:8px; display:grid; place-items:center; color:#fff; }
.ov-card .num{ font-size:18px; font-weight:800; letter-spacing:-.03em; line-height:1.1; }
.ov-card .lbl{ font-size:11px; color:var(--muted); font-weight:600; margin-top:3px; }

.usage{ min-width:110px; }
.usage .bar{ height:5px; margin-top:4px; border-radius:6px; background:#eceef3; overflow:hidden; }
.usage .bar span{ display:block; height:100%; border-radius:6px; background:var(--grad-brand); }

.detail{ display:flex; align-items:flex-start; gap:10px; height:100%; padding:12px; background:#fff; border:1px solid var(--line); border-radius:12px; transition:all .2s ease; }
.detail:hover{ border-color:#ffc2cd; box-shadow:0 10px 24px #16191f0d; transform:translateY(-2px); }
.detail .ico{ width:34px; height:34px; border-radius:10px; font-size:15px; display:grid; place-items:center; flex-shrink:0; background:#fff0f3; color:var(--brand); }
.detail .k{ font-size:9.5px; letter-spacing:.12em; font-weight:800; color:#92959e; text-transform:uppercase; }
.detail .v{ font-size:13px; font-weight:700; margin-top:2px; word-break:break-word; }
.copy-btn{ border:0; background:transparent; color:#9a9da5; padding:0 4px; }
.copy-btn:hover{ color:var(--brand); }
.tbl-title{ font-weight:800; font-size:14px; }

/* ---------- 17. Email template editor ---------- */
.template-editor{ min-height:520px; resize:vertical; font-size:12.5px; line-height:1.6; tab-size:4; }
.preview-wrapper{ min-height:520px; padding:16px; background:#f4f6f8; border:1px solid #e5e7eb; border-radius:12px; }
.preview-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.preview-frame{ width:100%; min-height:450px; background:#fff; border:1px solid #e5e7eb; border-radius:10px; }
.subject-preview{ margin-bottom:12px; padding:10px 14px; background:#fff; border:1px solid #e5e7eb; border-radius:10px; }
.subject-preview small{ display:block; margin-bottom:2px; font-size:11px; color:#6b7280; }
.placeholder-box{ padding:10px 14px; font-size:12.5px; background:#f8fafc; border:1px solid #e5e7eb; border-radius:10px; }
.placeholder-box code{ display:inline-block; margin:0 5px 5px 0; padding:3px 7px; background:#eef2ff; color:#4338ca; border-radius:5px; }

/* ---------- 18. Auth ---------- */
.auth{
    position:relative; overflow:hidden; width:100%; min-height:100vh; padding:18px;
    display:grid; place-items:center;
    background:linear-gradient(120deg,#fff0f3,#f1f3ff,#ffe9ee,#eef1ff); background-size:300% 300%;
    animation:gradShift 16s ease infinite;
}
.auth::before,.auth::after{ content:""; position:absolute; border-radius:50%; filter:blur(40px); opacity:.55; animation:floaty 7s ease-in-out infinite; }
.auth::before{ width:320px; height:320px; top:-80px; left:-80px; background:#ff9db0; }
.auth::after{ width:360px; height:360px; bottom:-100px; right:-100px; background:#b8c0ff; animation-delay:-3s; }
.auth-card{ position:relative; z-index:2; width:min(920px,100%); overflow:hidden; animation:fadeUp .7s ease both; }
.auth-side{ min-height:530px; padding:38px; color:#fff; background:linear-gradient(145deg,#0b0d12,#2c161e 62%,#a8002e); }
.auth-main{ padding:38px; }
.auth-logo{ width:76px; height:76px; border-radius:23px; font-size:31px; display:grid; place-items:center; background:var(--grad-brand); box-shadow:0 15px 40px #ff174455; animation:pulseRing 2.6s infinite; }
.auth .form-control,.auth .btn{ min-height:43px; }

/* ---------- 19. Flash alerts ---------- */
.alert{ font-size:12px; padding:.6rem .9rem; border-radius:11px; animation:fadeUp .4s ease both; }
.auth-flash{ position:absolute; top:15px; left:50%; z-index:10; width:100%; max-width:920px; transform:translateX(-50%); animation-name:fadeIn; }

/* ---------- 20. Mobile chrome ---------- */
.mobile-nav{ display:none; }
.offcanvas-menu{ width:260px !important; background:linear-gradient(180deg,#0d0f14,#1a0f18 55%,#2b0b17); }

/* ---------- 21. Responsive ---------- */
@media(max-width:991px){
    .topbar{ height:52px; }
    .sidebar{ display:none; }
    .content{ padding:12px 10px 76px; }
    .page-head h1{ font-size:19px; }

    .mobile-nav{
        display:flex; justify-content:space-around;
        position:fixed; left:0; right:0; bottom:0; z-index:1040; padding:6px 2px;
        background:rgba(255,255,255,.95); backdrop-filter:blur(10px); border-top:1px solid var(--line);
    }
    .mobile-nav a{ min-width:55px; font-size:9px; color:#666; text-align:center; text-decoration:none; transition:all .2s; }
    .mobile-nav a.active{ color:var(--brand); transform:translateY(-3px); }
    .mobile-nav i{ display:block; font-size:17px; line-height:19px; }
}

/* Mobile: table -> cards (labels admin.js lagata hai) */
@media(max-width:767px){
    .table{ min-width:0 !important; }
    .table-wrap{ overflow:visible; padding:8px 10px; }
    .table thead{ display:none; }
    .table,.table tbody,.table tr,.table td{ display:block; width:100%; }
    .table tr{ margin:0 0 8px; padding:4px 12px; background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:0 3px 10px #16191f08; }
    .table tbody tr:hover{ background:#fff; }
    .table td{ display:flex; justify-content:space-between; align-items:center; gap:12px; padding:6px 0; border:0; border-bottom:1px dashed #eceef3; text-align:right; }
    .table td:last-child{ border-bottom:0; }
    .table td::before{ content:attr(data-label); flex-shrink:0; text-align:left; font-size:9.5px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:#858995; }
    .table td[data-label=""]::before{ display:none; }
    .table td[data-label=""]{ justify-content:flex-end; }
    .table td.empty{ display:block; padding:24px 0; text-align:center; }
    .table td.empty::before{ display:none; }

    .hero h1{ font-size:18px; }
    .u-hero h2{ font-size:17px; }
    .page-head > .btn,.page-head .actions{ width:100%; }
}

@media(max-width:575px){
    .topbar{ height:50px; }
    .content{ padding:10px 8px 76px; }
    .card{ border-radius:12px; }
    .card-body{ padding:12px; }
    .page-head{ flex-direction:column; align-items:flex-start; }
    .page-head .actions{ display:flex; flex-wrap:wrap; }
    .stat-num{ font-size:18px; }
    .auth{ padding:10px; }
    .auth-side{ display:none; }
    .auth-main{ padding:22px 18px; }
}

@media(prefers-reduced-motion:reduce){
    *{ animation:none !important; transition:none !important; }
    .fade-up{ opacity:1; }
}
