/* 1. Root Variables */
:root {
    --bg-gradient: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(255, 255, 255, 1);
    --text-main: #2d3436;
    --text-sub: #636e72;
    --accent: #0984e3;
    --shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
}

/* 2. Universal Typography & Safety Reset */
*, html, body, input, button, select, textarea {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    box-sizing: border-box;
}

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    margin: 0;
    padding: clamp(15px, 5vw, 40px);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* 3. Smart Header (Public) */
.brand-title {
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: 800;
    text-align: center;
    margin-bottom: clamp(20px, 6vw, 50px);
    letter-spacing: -0.02em;
}

/* 4. The Smart Grid System (Public) */
.grid-container {
    display: flex;
    flex-wrap: wrap; 
    gap: 25px;
    width: 100%;
    max-width: 1400px;
    justify-content: center;
    margin: 0 auto;
}

/* 5. Smart Crate Buttons (Public) */
.crate-btn {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 24px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    flex-shrink: 0; 
}

.crate-btn:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 45px rgba(0,0,0,0.1);
}

.crate-logo {
    width: 75%;
    height: 60%;
    object-fit: contain;
    margin-bottom: 12px;
}

.crate-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.crate-desc {
    font-size: 0.85rem;
    color: var(--text-sub);
    line-height: 1.3;
}

/* --- MOBILE SPECIFIC LOGIC --- */
@media (max-width: 768px) {
    .grid-container {
        display: grid; 
        grid-template-columns: repeat(2, 1fr); 
        gap: 12px;
        padding: 5px;
    }
    .crate-btn {
        width: 100% !important; 
        height: auto !important; 
        aspect-ratio: 1 / 1; 
        padding: 12px;
        border-radius: 18px;
    }
    .crate-desc { display: none; }
    .crate-title { font-size: 0.9rem; }
}

/* 6. Premium Login Screen */
.login-wrapper {
    width: 90%;
    max-width: 400px;
    margin: auto; 
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 40px 30px;
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 255, 255, 0.8);
    text-align: center;
}

.login-title { margin: 0 0 8px 0; font-size: 1.8rem; font-weight: 800; color: var(--text-main); }
.login-subtitle { margin: 0 0 25px 0; color: var(--text-sub); font-size: 0.95rem; }

.error-msg {
    background: rgba(255, 118, 117, 0.1);
    color: #d63031;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.login-form input[type="password"] {
    display: block !important;
    width: 100% !important;
    padding: 16px !important;
    margin: 0 0 20px 0 !important;
    border: 2px solid #edf2f7 !important;
    border-radius: 12px !important;
    background: #f8fafc !important;
    font-size: 1rem !important;
    transition: all 0.3s ease !important;
    outline: none !important;
    box-sizing: border-box !important;
}

.login-form input[type="password"]:focus {
    border-color: var(--accent) !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(9, 132, 227, 0.15) !important;
}

.btn-login {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(9, 132, 227, 0.3); }

/* 7. Command Center Dashboard Layout */
.admin-container {
    width: 100%;
    max-width: clamp(340px, 95vw, 1100px);
    margin: 20px auto;
}

.admin-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

/* -- Analytics Stat Grid -- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-label { font-size: 0.9rem; color: var(--text-sub); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.stat-value { font-size: 2.5rem; font-weight: 800; color: var(--accent); }

/* -- Admin Cards & Rows -- */
.admin-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 35px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.05);
}

.admin-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 16px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

/* -- Global Admin Inputs -- */
input[type="text"], input[type="number"] {
    display: block !important;
    width: 100%;
    padding: 12px !important;
    margin: 0 !important;
    border: 1px solid #dfe6e9 !important;
    border-radius: 10px !important;
    background: #fff !important;
    font-size: 0.95rem;
}

.inline-edit-form { display: flex; flex: 1; gap: 15px; align-items: center; flex-wrap: wrap; }
.input-group { display: flex; flex: 1; gap: 10px; min-width: 200px; }
.action-group { display: flex; gap: 10px; }

/* -- Global Buttons -- */
button {
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    background: var(--accent);
    color: white;
    white-space: nowrap;
    transition: 0.2s;
}

.btn-update { background: #00cec9; }
.btn-update:hover { background: #00b894; }
.btn-danger { background: #ff7675; }
.btn-danger:hover { background: #d63031; }

.btn-outline {
    padding: 10px 18px;
    border-radius: 10px;
    border: 2px solid #dfe6e9;
    text-decoration: none;
    font-weight: 700;
    color: var(--text-main);
    transition: 0.2s;
}
.btn-outline:hover { background: #dfe6e9; }

/* -- Drag & Drop -- */
.sortable-ghost { opacity: 0.4; border: 2px dashed #cbd5e1; background: #f8fafc; }
.drag-handle { cursor: grab; font-size: 1.5rem; color: #cbd5e1; padding: 0 10px; user-select: none; }
.drag-handle:active { cursor: grabbing; color: var(--accent); }

/* 8. Secret Triggers */
.secret-admin-trigger { position: fixed; top: 0; right: 0; width: 30px; height: 30px; opacity: 0; z-index: 9999; }
.secret-cpanel-trigger { position: fixed; bottom: 0; right: 0; width: 30px; height: 30px; opacity: 0; z-index: 9999; }