/* 
 * LinkMagz Inspired Theme System (Sugeng.id Aesthetic)
 * Crisp, fast-loading, ultra-clean UI with LinkMagz Signature Blue
 */

:root {
    --bg-main: #f4f7fa;
    --bg-card: #ffffff;
    --bg-card-border: #e2e8f0;
    --bg-modal: #ffffff;
    --bg-input: #f8fafc;
    
    /* LinkMagz Signature Colors */
    --primary: #0056b3;
    --primary-hover: #004085;
    --primary-light: #e6f0fa;
    --accent: #0284c7;
    --accent-hover: #0369a1;
    --accent-light: #e0f2fe;
    
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.1);
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: #edf2f7;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Container */
.app-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* LinkMagz Style Top Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--primary);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 86, 179, 0.3);
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.accent { background: var(--accent-light); color: var(--accent); }

.stat-details h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-details .value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    margin-top: 2px;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 14px;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* App Cards Grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.app-card.inactive::before {
    background: var(--text-dim);
}

.app-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.app-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    gap: 10px;
}

.app-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.app-pkg {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    font-weight: 600;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.badge-active { background: var(--success-light); color: #047857; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-inactive { background: var(--danger-light); color: #b91c1c; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-label { background: var(--primary-light); color: var(--primary); border: 1px solid rgba(0, 86, 179, 0.2); }

.app-details-list {
    margin: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.app-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 6px;
    border-bottom: 1px dashed #e2e8f0;
}

.app-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

/* Buttons (LinkMagz Style Buttons) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.2;
}

.btn-sm {
    padding: 6px 11px;
    font-size: 0.78rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 86, 179, 0.2);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 10px rgba(0, 86, 179, 0.3);
}

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

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid var(--bg-card-border);
}
.btn-secondary:hover {
    background: #e2e8f0;
    color: var(--text-main);
}

.btn-danger {
    background: var(--danger-light);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-block {
    width: 100%;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-modal);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-top: 4px solid var(--primary);
}

.modal-content.modal-lg {
    max-width: 820px;
}

@keyframes modalPop {
    from { transform: translateY(12px) scale(0.98); }
    to { transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--bg-card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}
.close-btn:hover { color: var(--text-main); }

.modal-body {
    padding: 22px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 0.88rem;
    transition: var(--transition);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.12);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Login Page Style (LinkMagz Style Card) */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background-color: var(--bg-main);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--primary);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-header .logo-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin: 0 auto 12px;
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.3);
}

.login-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

.login-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.login-footer code {
    background: var(--primary-light);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--primary);
    font-weight: 600;
}

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.alert-danger {
    background: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #b91c1c;
}

/* AdMob Accounts List in Modal */
.admob-list-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.admob-account-item {
    background: #f8fafc;
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    position: relative;
    transition: var(--transition);
}

.admob-account-item.active {
    border-color: var(--success);
    background: #f0fdf4;
}

.admob-account-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.admob-label-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.unit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.unit-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 6px 10px;
    border-radius: 4px;
}

.unit-item strong {
    color: var(--primary);
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.unit-item code {
    font-family: monospace;
    color: var(--text-main);
    word-break: break-all;
    font-weight: 500;
}

/* API Code Viewer */
.code-viewer {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-family: monospace;
    font-size: 0.82rem;
    color: #38bdf8;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}
