/* =========================================
   PHUMELELA ADMIN PANEL
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --red: #D32F2F;
    --red-dark: #b01218;
    --dark: #0f0f0f;
    --darker: #0a0a0a;
    --sidebar: #151515;
    --card: #1a1a1a;
    --border: #2a2a2a;
    --text: #e5e5e5;
    --text-dim: #888;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
}

body {
    font-family: 'Inter', sans-serif;
    background: #0f0f0f;
    color: var(--text);
    line-height: 1.5;
}

/* ==================
   LOGIN PAGE
   ================== */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a0000 100%);
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 50px 40px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

/* ✅ Login Logo Image */
.login-logo-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: white;
    border-radius: 16px;
    padding: 5px;
    margin: 0 auto 15px;
    display: block;
    box-shadow: 0 0 30px rgba(211, 47, 47, 0.5);
}

.login-logo h1 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.6rem;
    letter-spacing: 3px;
    color: white;
}

.login-logo p {
    color: var(--text-dim);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 5px;
}

.login-box .form-group { margin-bottom: 20px; }

.login-box label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: #0a0a0a;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s;
}

.input-wrap:focus-within {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.15);
}

.input-wrap i {
    padding: 0 15px;
    color: var(--text-dim);
    font-size: 0.95rem;
}

.input-wrap:focus-within i { color: var(--red); }

.input-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 15px 15px 15px 0;
    color: white;
    font-size: 1rem;
    font-family: inherit;
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #D32F2F 0%, #9A0007 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(211, 47, 47, 0.4);
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
}

.login-footer a {
    color: var(--text-dim);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.3s;
}

.login-footer a:hover { color: var(--red); }

/* ==================
   ADMIN LAYOUT
   ================== */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

/* ✅ Sidebar Logo Image */
.sidebar-logo {
    padding: 25px 20px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    background: white;
    border-radius: 8px;
    padding: 3px;
    flex-shrink: 0;
}

.sidebar-logo h1 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: white;
    margin-bottom: 2px;
}

.sidebar-logo span {
    font-size: 0.7rem;
    color: var(--red);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 25px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text);
}

.sidebar-nav a.active {
    color: white;
    background: rgba(211, 47, 47, 0.1);
    border-left-color: var(--red);
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px 0;
    border-top: 1px solid var(--border);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
    color: var(--text-dim);
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-footer a:hover { color: var(--text); }
.sidebar-footer a.logout:hover { color: var(--red); }

/* Main Content */
.admin-main {
    margin-left: 260px;
    min-height: 100vh;
}

.admin-topbar {
    background: var(--sidebar);
    border-bottom: 1px solid var(--border);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-topbar h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.5rem;
    letter-spacing: 1px;
    color: white;
}

.admin-topbar p {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-top: 3px;
}

.admin-topbar strong { color: var(--red); }

.topbar-user {
    font-size: 2rem;
    color: var(--text-dim);
}

.admin-content {
    padding: 30px 40px;
}

/* ==================
   STATS
   ================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: var(--red);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    color: white;
    flex-shrink: 0;
}

.stat-icon.red { background: linear-gradient(135deg, #D32F2F, #9A0007); }
.stat-icon.blue { background: linear-gradient(135deg, #2980b9, #1c5a85); }
.stat-icon.green { background: linear-gradient(135deg, #27ae60, #1e8449); }
.stat-icon.orange { background: linear-gradient(135deg, #f39c12, #b9770e); }

.stat-info span {
    display: block;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.stat-info h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.9rem;
    color: white;
    margin-top: 3px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ==================
   PANELS
   ================== */
.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.panel-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.15rem;
    letter-spacing: 1px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h3 i { color: var(--red); }

.btn-link {
    color: var(--red);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-link:hover { transform: translateX(5px); }

/* ==================
   TABLES
   ================== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table thead {
    background: #0a0a0a;
}

.admin-table th {
    padding: 15px 25px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    font-weight: 600;
}

.admin-table td {
    padding: 18px 25px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text);
}

.admin-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.empty-row {
    text-align: center;
    padding: 40px 25px !important;
    color: var(--text-dim);
    font-style: italic;
}

.article-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.article-link:hover { color: var(--red); }

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #2a2a2a;
    color: #ccc;
}

.badge-hard-news { background: #7a1c1c; color: #ffb3b3; }
.badge-opinion { background: #1c4a7a; color: #b3d4ff; }
.badge-environment { background: #1c7a3f; color: #b3ffd4; }
.badge-religious { background: #7a4a1c; color: #ffd4b3; }
.badge-oceans-economy { background: #1c7a7a; color: #b3ffff; }
.badge-arts-culture { background: #7a1c7a; color: #ffb3ff; }
.badge-misc { background: #4a4a4a; color: #ddd; }

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.status-unsubscribed { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }

/* Actions */
.actions { display: flex; gap: 8px; }

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: white;
    font-size: 0.85rem;
}

.btn-edit { background: #2980b9; }
.btn-edit:hover { background: #3498db; transform: scale(1.1); }

.btn-delete { background: #c0392b; }
.btn-delete:hover { background: #e74c3c; transform: scale(1.1); }

/* Category List */
.category-list { padding: 15px 25px; }

.cat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.cat-row:last-child { border-bottom: none; }

.cat-name {
    text-transform: capitalize;
    font-size: 0.9rem;
    color: var(--text);
}

.cat-count {
    background: var(--red);
    color: white;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ==================
   FORMS
   ================== */
.admin-form { padding: 30px; }

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

@media (max-width: 700px) {
    .form-row { grid-template-columns: 1fr; }
}

.admin-form .form-group { margin-bottom: 22px; }

.admin-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.admin-form label small {
    text-transform: none;
    color: var(--text-dim);
    font-weight: 400;
    letter-spacing: 0;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
    width: 100%;
    padding: 13px 15px;
    background: #0a0a0a;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.15);
}

.admin-form textarea {
    resize: vertical;
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
}

.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: 10px;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 13px 26px;
    border-radius: 8px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: var(--red);
    color: white;
}

.btn-primary:hover {
    background: var(--red-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(211, 47, 47, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: 8px;
    margin: 20px 25px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: rgba(46, 204, 113, 0.1); color: #2ecc71; border: 1px solid rgba(46, 204, 113, 0.3); }
.alert-error { background: rgba(231, 76, 60, 0.1); color: #e74c3c; border: 1px solid rgba(231, 76, 60, 0.3); }
.alert-warning { background: rgba(243, 156, 18, 0.1); color: #f39c12; border: 1px solid rgba(243, 156, 18, 0.3); }

/* Responsive */
@media (max-width: 900px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .admin-main { margin-left: 0; }
    .admin-topbar, .admin-content { padding: 20px; }
}

/* =========================================
   EDIT SUBSCRIBER MODAL INPUTS (NEW)
   ========================================= */
#editModal input[type="text"],
#editModal input[type="email"],
#editModal select {
    width: 100%;
    padding: 12px 15px;
    background: #0a0a0a;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
    margin-top: 5px;
}

#editModal input[type="text"]:focus,
#editModal input[type="email"]:focus,
#editModal select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.15);
    background: #111;
}

#editModal label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    margin-top: 15px;
}

/* Fix the dropdown arrow color for dark mode */
#editModal select {
    appearance: none;
    -webkit-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%23aaaaaa%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;
    background-position: right 15px top 50%;
    background-size: 12px auto;
    cursor: pointer;
}