/* =========================================================
   L-Manager Pro - Global Stylesheet
   Version: 2.0 (Fully Optimized & 100% Responsive)
========================================================= */

/* --- 1. CSS Variables --- */
:root {
    --primary-color: #0f172a;
    --secondary-color: #3b82f6;
    --secondary-hover: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-focus: #93c5fd;
}

/* --- 2. Global Resets --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-dark);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    transition: all 0.3s ease;
}

/* --- 3. Base Layout & Cards --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
    flex-direction: row;
    position: relative;
}

.main-content {
    flex: 1;
    padding: 30px 40px;
    width: calc(100% - 260px);
    overflow-x: hidden;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
}

.card h2, .card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* --- 4. Sidebar (Off-Canvas & Desktop) --- */
.sidebar {
    width: 260px;
    background: var(--primary-color);
    color: #ffffff;
    padding: 25px 20px;
    flex-shrink: 0;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-brand-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 15px;
}

.sidebar-brand {
    margin: 0;
    font-size: 1.4rem;
    color: #fff;
    letter-spacing: 1px;
}

.sidebar-brand span {
    color: var(--secondary-color);
}

.close-sidebar-btn {
    background: transparent;
    border: none;
    color: #fca5a5;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    display: none;
    padding: 0;
    transition: color 0.2s;
}

.close-sidebar-btn:hover { color: #ef4444; }

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: #cbd5e1;
    border-radius: 8px;
    font-weight: 500;
}

.sidebar-nav a:hover, .sidebar-nav a.active-menu {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left: 4px solid var(--secondary-color);
    padding-left: 11px;
}

.logout-item { margin-top: 40px; }
.logout-link { color: #fca5a5 !important; }
.logout-link:hover { background: rgba(239, 68, 68, 0.15) !important; color: #f87171 !important; }

/* Overlay */
.sidebar-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(2px) !important;
    z-index: 9998 !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out !important;
}

.sidebar-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
}

/* --- 5. Admin Header --- */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--text-dark);
    padding: 5px;
}

/* --- 6. Forms & Inputs --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: #f8fafc;
    color: var(--text-dark);
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border: 1px solid var(--secondary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%231e293b%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat, repeat;
    background-position: right .7em top 50%, 0 0;
    background-size: .65em auto, 100%;
}

/* --- 7. Buttons --- */
.btn {
    display: inline-block; width: 100%; padding: 14px 20px;
    background: var(--secondary-color); color: #ffffff;
    border: none; border-radius: 8px; font-weight: 600; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--secondary-hover); }

.action-btn {
    display: inline-block; padding: 6px 12px; border-radius: 6px;
    font-size: 0.85rem; font-weight: 600; color: #ffffff;
    margin-right: 5px; margin-bottom: 5px; border: none; cursor: pointer;
}
.btn-suspend { background: var(--warning-color); }
.btn-activate { background: var(--success-color); }
.btn-delete { background: var(--danger-color); }
.btn-warning { background: var(--warning-color); }
.btn-warning:hover { background: #d97706; }
.btn-secondary { background: #64748b; }
.btn-secondary:hover { background: #475569; }

.copy-btn { background: #475569; transition: all 0.2s; }
.copy-btn:hover { background: #334155; }

/* --- 8. Tables --- */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.custom-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.custom-table th, .custom-table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border-color); white-space: nowrap; vertical-align: middle; }
.custom-table th { background: #f8fafc; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; }

.license-key-cell { display: flex; align-items: center; gap: 8px; height: 100%; }
.license-key-cell code { margin-bottom: 0 !important; }
.custom-table td.actions-cell { display: flex; align-items: center; gap: 6px; border-bottom: none; }
.custom-table td.actions-cell .action-btn { margin: 0; }

code { background: #f1f5f9; padding: 4px 8px; border-radius: 6px; font-family: monospace; border: 1px solid var(--border-color); }

/* --- 9. Badges & Alerts --- */
.badge { padding: 5px 12px; border-radius: 50px; font-size: 0.8rem; font-weight: 600; display: inline-block; }
.badge-active { background: #dcfce3; color: #15803d; }
.badge-suspended { background: #fee2e2; color: #b91c1c; }
.badge-expired { background: #fef08a; color: #854d0e; }

.alert { padding: 16px; border-radius: 8px; margin-bottom: 20px; font-weight: 500; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* --- 10. Dashboard Stats Grid --- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--bg-card); padding: 25px; border: 1px solid var(--border-color); border-radius: 10px; text-align: center; }
.stat-card h3 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 10px; }
.stat-card .val { font-size: 2.2rem; font-weight: 800; }

/* --- 11. Security Logs & Notifications --- */
.notification-wrapper { position: relative; display: inline-block; }
.notification-bell { font-size: 1.5rem; cursor: pointer; padding: 8px; border-radius: 50%; background: #f1f5f9; position: relative; }
.badge-count { position: absolute; top: 0; right: 0; background: #ef4444; color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 50px; transform: translate(25%, -25%); animation: pulse 2s infinite; }

.notification-dropdown { position: absolute; top: 120%; right: 0; width: 320px; background: #fff; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); opacity: 0; visibility: hidden; z-index: 1000; border: 1px solid #e2e8f0; }
.notification-dropdown.active { opacity: 1; visibility: visible; }
.dropdown-header { display: flex; justify-content: space-between; padding: 15px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; border-radius: 12px 12px 0 0; }
.dropdown-body { max-height: 300px; overflow-y: auto; }
.notif-item { display: flex; padding: 15px; gap: 15px; border-bottom: 1px solid #f1f5f9; }
.notif-icon { font-size: 1.2rem; width: 35px; height: 35px; display: flex; align-items: center; justify-content: center; border-radius: 8px; flex-shrink: 0; }

.abuse-domain_mismatch, .badge.abuse-badge-domain_mismatch { background: #ffedd5; color: #c2410c; }
.abuse-invalid_key, .badge.abuse-badge-invalid_key { background: #fee2e2; color: #b91c1c; }
.abuse-suspended_key, .badge.abuse-badge-suspended_key { background: #f3e8ff; color: #7e22ce; }
.abuse-expired_key, .badge.abuse-badge-expired_key { background: #fef9c3; color: #a16207; }

.log-row.unread-log { background-color: #fff1f2; font-weight: 500; }
.badge.status-badge-unread { background: #ef4444; color: #ffffff; }
.badge.status-badge-read { background: #e2e8f0; color: #475569; }
.badge.status-badge-resolved { background: #dcfce3; color: #166534; }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.7); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* --- 12. GLOBAL RESPONSIVE MEDIA QUERIES --- */

/* Tablet / Small Desktop */
@media (max-width: 992px) {
    .sidebar {
        position: fixed !important;
        left: -320px !important;
        top: 0 !important;
        height: 100vh !important;
        z-index: 9999 !important;
        box-shadow: 5px 0 25px rgba(0,0,0,0.5) !important;
    }
    .sidebar.active { left: 0 !important; }
    .close-sidebar-btn { display: block !important; }
    .menu-toggle { display: block; }
    
    .main-content {
        width: 100%;
        padding: 20px;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    .stat-grid, .form-grid { grid-template-columns: 1fr; }
    .card { padding: 15px; }
    .admin-header { padding: 12px 15px; }
    .admin-header h2 { font-size: 1.1rem; }
    
    .custom-table th, .custom-table td { padding: 12px 10px; font-size: 0.9rem; }
    .custom-table td.actions-cell { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
    
    .notification-dropdown { width: 280px; right: -20px; }
    .log-header-section { flex-direction: column; align-items: flex-start !important; }
}

/* Small Mobile */
@media (max-width: 480px) {
    .main-content { padding: 15px 10px; }
    .btn { padding: 12px; font-size: 0.95rem; }
}

/* =========================================================
   16. Login Page Specific Styles (100% Responsive)
========================================================= */

/* Center the login box perfectly on the screen */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-body); 
    padding: 20px; /* Safe padding for small mobile screens */
}

/* Restrict maximum width for a premium look */
.login-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

/* Enhanced Login Card Design */
.login-card {
    padding: 40px 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    margin-bottom: 0; /* Override default card margin */
    background: var(--bg-card);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* Added slight spacing for the login button */
.login-card .btn-primary {
    margin-top: 15px !important;
    padding: 14px 20px;
    font-size: 1.05rem;
}

/* =========================================================
   Mobile Responsiveness for Login Page
========================================================= */
@media (max-width: 480px) {
    .login-body {
        padding: 15px;
    }
    
    .login-card {
        padding: 30px 20px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    }
    
    .login-header h2 {
        font-size: 1.5rem;
    }
    
    .login-header {
        margin-bottom: 25px;
    }
}

/* =========================================================
   17. Smart Pagination & Bulk Actions Styling
========================================================= */

/* Pagination Container */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: #f8fafc;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.page-link:hover:not(.disabled):not(.dots):not(.active) {
    background: var(--secondary-color);
    color: #ffffff;
    border-color: var(--secondary-color);
}

.page-link.active {
    background: var(--secondary-color);
    color: #ffffff;
    border-color: var(--secondary-color);
    cursor: default;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.page-link.disabled {
    color: #94a3b8;
    background: #f1f5f9;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

.page-link.dots {
    background: transparent;
    border: none;
    color: var(--text-muted);
    min-width: auto;
    padding: 0 5px;
}

/* Bulk Action Buttons Mobile Fix */
@media (max-width: 768px) {
    .bulk-action-form {
        width: 100%;
        flex-direction: column;
    }
    
    .bulk-action-form .action-btn {
        width: 100%;
        text-align: center;
    }
}