/* ==========================================================================
   KEYAUTH.CC STRICT CLONE THEME
   ========================================================================== */
:root {
    color-scheme: dark;
    --bg-main: #121212;
    --bg-surface: #1e1e1e;
    --bg-surface-hover: #2a2a2a;
    --bg-input: #121212;
    
    --border-color: #2d2d2d;
    --border-light: #3d3d3d;
    
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    
    /* KeyAuth Exact Button Colors */
    --color-blue: #2563eb;
    --color-blue-hover: #1d4ed8;
    --color-green: #16a34a;
    --color-green-hover: #15803d;
    --color-purple: #9333ea;
    --color-purple-hover: #7e22ce;
    --color-teal: #0d9488;
    --color-teal-hover: #0f766e;
    --color-orange: #ea580c;
    --color-orange-hover: #c2410c;
    --color-red: #dc2626;
    --color-red-hover: #b91c1c;

    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Base Components */
.hidden {
    display: none !important;
}

a {
    color: var(--color-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Forms & Inputs */
input[type="text"],
input[type="password"],
input[type="number"],
select,
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
.form-control:focus {
    border-color: var(--color-blue);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: #fff;
}

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

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

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

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

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

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

.btn-secondary {
    background: var(--bg-surface-hover);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--border-light);
}

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-main);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
}

.sidebar-brand {
    padding: 20px;
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
}

.sidebar-app-selector {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-app-selector label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-main);
    background: var(--bg-surface);
    border-left: 3px solid var(--text-main);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* Main Content Area */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-surface);
}

/* Top Navbar */
.top-navbar {
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--bg-surface);
    flex-shrink: 0;
}

.search-container {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    width: 300px;
}

.search-container i {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-right: 8px;
}

.search-container input {
    border: none;
    background: transparent;
    padding: 0;
    width: 100%;
}

.search-container input:focus {
    border: none;
}

.top-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 0.85rem;
    font-weight: 600;
}

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

/* Content Area */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb i {
    font-size: 0.7rem;
    margin: 0 8px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tab-content {
    display: none;
}

.tab-content.active-content {
    display: block;
}

/* Stats Blocks */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-block {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Two Column Layout (Overview) */
.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Card Style */
.card {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

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

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

.card-body {
    padding: 20px;
}

/* Credentials List */
.credential-item {
    margin-bottom: 20px;
}

.credential-item:last-child {
    margin-bottom: 0;
}

.credential-item label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.credential-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
}

.credential-value {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.credential-box i {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}

.credential-box i:hover {
    color: var(--text-main);
}

/* Notice Box */
.notice-box {
    background: rgba(37, 99, 235, 0.1);
    border-left: 4px solid var(--color-blue);
    padding: 16px;
    border-radius: 4px;
    margin-top: 20px;
}

.notice-box h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--color-blue);
    margin-bottom: 4px;
}

.notice-box p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* App List (Right Column) */
.app-list-header {
    background: var(--bg-surface);
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 16px;
}

.app-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.app-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

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

.status-badge {
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.status-badge.active {
    background: rgba(22, 163, 74, 0.2);
    color: #4ade80;
    border: 1px solid rgba(22, 163, 74, 0.4);
}

.app-stats-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.app-stat-col {
    text-align: center;
}

.app-stat-col span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.app-stat-col strong {
    font-size: 1rem;
}

.app-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Table container */
.table-container {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow-x: auto;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
}

.table-container th {
    text-align: left;
    padding: 14px 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.table-container td {
    padding: 16px 20px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

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

.table-container tr:hover td {
    background: var(--bg-surface-hover);
}

/* Utilities */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
    max-width: 450px;
    padding: 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

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

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

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-surface);
    border-left: 4px solid var(--color-blue);
    padding: 16px 24px;
    border-radius: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 3000;
    font-weight: 500;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.toast-error { border-left-color: var(--color-red); }
.toast.toast-success { border-left-color: var(--color-green); }

/* Login Container */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    padding: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.login-brand {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 30px;
}
