/* =======================================================
   System Name: License Manager Pro - CODBOX Style v2.0
   ======================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    /* MODO CLARO (Default) */
    --bg-color: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-input: #ffffff;
    --text-main: #333333;
    --text-muted: #777777;
    --border-color: #e6e6e6;
    --top-bar: #f39c12;
    /* Laranja CODBOX */

    --primary: #f39c12;
    --primary-hover: #e67e22;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f1c40f;
    --text-title: #1a1a1a;

    --sidebar-width: 260px;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* MODO DARK */
body.dark-theme {
    --bg-color: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #1e293b;
    --bg-input: #0f172a;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --top-bar: #d97706;
    /* Um laranja um pouco mais escuro p/ dark */
    --text-title: #f8fafc;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
    transition: background-color 0.3s, color 0.3s;
    margin: 0;
}

.mobile-header {
    display: none;
}

/* ── Sidebar Style CODBOX ── */
.sidebar {
    width: var(--sidebar-width) !important;
    height: 100vh !important;
    background-color: var(--bg-sidebar) !important;
    border-right: 1px solid var(--border-color);
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.03);
    transition: background-color 0.3s;
}

.sidebar-header {
    padding: 35px 25px;
    display: flex;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-title);
    letter-spacing: -0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-links {
    list-style: none;
    padding: 10px 0;
    flex: 1;
}

.nav-links li {
    padding: 5px 0;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 25px;
    color: var(--text-main) !important;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.nav-links a:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--primary) !important;
}

body.dark-theme .nav-links a:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-links a.active {
    color: var(--primary) !important;
    font-weight: 700;
    border-right: 4px solid var(--primary);
}

/* Boxes coloridos dos ícones */
.icon-box {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.icon-box i {
    line-height: 1;
}

.icon-box.orange {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.icon-box.yellow {
    background: linear-gradient(135deg, #f1c40f, #f39c12);
}

.icon-box.brown {
    background: linear-gradient(135deg, #a04000, #78281f);
}

.icon-box.gold {
    background: linear-gradient(135deg, #d4ac0d, #b7950b);
}

.icon-box.logout {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

/* ── Layout Main e Top Bar ── */
.main-content {
    margin-left: var(--sidebar-width) !important;
    min-height: 100vh;
}

.top-bar-orange {
    height: 140px;
    background-color: var(--top-bar);
    width: 100%;
    margin-bottom: -90px;
    transition: background-color 0.3s;
}

.content-wrapper {
    padding: 0 40px 40px 40px;
}

.page-header {
    padding: 15px 0 25px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
}

.page-header h2 {
    font-size: 26px;
    color: #fff;
    font-weight: 700;
}

/* ── Cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    position: relative;
    z-index: 20;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, background-color 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-title);
}

.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 30px;
    overflow: hidden;
    transition: background-color 0.3s;
}

.card-header {
    background: rgba(0, 0, 0, 0.02);
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-title);
}

.card-body {
    padding: 25px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 14px;
    transition: 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.1);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
    text-decoration: none !important;
}

.btn-primary {
    background: var(--primary);
    color: #fff !important;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-main) !important;
}

.btn-secondary:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
}

/* ── Table ── */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 18px 25px;
    text-align: left;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
    border-bottom: 2px solid var(--border-color);
    letter-spacing: 0.5px;
}

td {
    padding: 18px 25px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

tr:hover td {
    background: rgba(0, 0, 0, 0.01);
}

.license-key {
    background: var(--bg-input);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--primary);
    border: 1px solid var(--border-color);
}

/* ── Badges Status ── */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-active {
    background: rgba(39, 174, 96, 0.15);
    color: #27ae60;
}

.badge-expired {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.badge-inactive {
    background: rgba(149, 165, 166, 0.15);
    color: #7f8c8d;
}

/* ── Modal Style ── */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    width: 100%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    background: var(--primary);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
}

.close-modal:hover {
    opacity: 1;
}

.modal-body {
    padding: 30px 25px;
}

/* ── Dark Mode Toggle Button ── */
.theme-switch {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1500;
    border: none;
    font-size: 20px;
    transition: transform 0.2s;
}

.theme-switch:hover {
    transform: scale(1.1);
}

/* ── Auth Page (Login) ── */
.auth-body {
    background: var(--bg-color) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    animation: modalIn 0.4s ease;
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-title);
    margin-top: 10px;
}

.auth-logo p {
    color: var(--text-muted);
    font-size: 14px;
}

.btn-block {
    width: 100%;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .sidebar {
        left: -260px !important;
    }

    .sidebar.active {
        left: 0 !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .top-bar-orange {
        height: 130px;
        margin-bottom: -90px;
    }

    .content-wrapper {
        padding: 0 15px 20px 15px;
    }

    .theme-switch {
        bottom: 80px;
    }

    .mobile-header {
        display: flex !important;
        background: var(--bg-card);
        padding: 15px 20px;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        z-index: 999;
        justify-content: space-between;
        align-items: center;
    }
}