/* =========================================================================
   Sherif Shaaban Digital Ecosystem - Publisher Panel CSS (publisher-panel)
   Theme: Sleek Blogger Cyber-Glass (Accent: Blogger Orange #ff5722)
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&family=Inter:wght@400;500;600;700;900&display=swap');

:root {
    /* Color Tokens */
    --bg-dark: #0b0c10;
    --bg-card: rgba(18, 22, 33, 0.5);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 255, 255, 0.18);
    
    --primary: #ff5722; /* Blogger Orange */
    --primary-glow: rgba(255, 87, 34, 0.35);
    --secondary: #ff8f00; /* Warm Amber */
    --secondary-glow: rgba(255, 143, 0, 0.25);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --font-ar: 'Cairo', sans-serif;
    --font-en: 'Inter', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-ar);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    direction: rtl; /* RTL First */
}

/* Glowing Orbs */
.glow-orb {
    position: absolute;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    opacity: 0.3;
    pointer-events: none;
    animation: pulse 8s infinite alternate;
}

.orb-orange {
    background: var(--primary);
    top: -50px;
    right: -50px;
}

.orb-amber {
    background: var(--secondary);
    bottom: -50px;
    left: -50px;
    animation-delay: 2s;
}

@keyframes pulse {
    0% { transform: scale(1) translate(0, 0); opacity: 0.25; }
    100% { transform: scale(1.15) translate(20px, -20px); opacity: 0.45; }
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--glass-border);
    background: rgba(11, 12, 16, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-text {
    font-family: var(--font-en);
    font-weight: 900;
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}

.brand-text span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.publisher-badge {
    background: rgba(255, 87, 34, 0.15);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Glass Panel */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
    transition: var(--transition);
}

.glass-panel:hover {
    border-color: var(--glass-border-hover);
}

/* Dashboard Layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 1.5rem;
    flex: 1;
}

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* Sidebar */
.sidebar {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 90px;
}

.publisher-profile {
    text-align: center;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
}

.avatar-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    border: 2.5px solid var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
    overflow: hidden;
    background: #1e293b;
}

.avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.publisher-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.publisher-email {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-en);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    cursor: pointer;
}

.menu-item:hover, .menu-item.active {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-right: 3.5px solid var(--primary);
    padding-right: calc(1rem - 3.5px);
}

/* Workspace */
.workspace {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.workspace-section {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 900;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon {
    font-size: 2rem;
    color: var(--primary);
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 87, 34, 0.1);
}

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

.stat-value {
    font-size: 1.6rem;
    font-weight: 900;
    font-family: var(--font-en);
}

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

/* Toolbar & Forms */
.toolbar {
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-input-wrapper i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-control {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.search-control:focus {
    border-color: var(--primary);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.admin-table th {
    padding: 1rem 1.5rem;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1.5px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.01);
}

.admin-table td {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Form Controls */
.form-group {
    margin-bottom: 1.25rem;
    text-align: right;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 16px rgba(255, 87, 34, 0.5);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border-hover);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* Badge */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 12, 16, 0.8);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    opacity: 1;
    transition: var(--transition);
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    position: relative;
    border: 1px solid var(--glass-border);
    animation: modalSlideUp 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

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

/* Templates Embed Code Box */
.template-box {
    background: #060913;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 250px;
    overflow-y: auto;
    color: #a7f3d0;
    direction: ltr; /* LTR for code */
    text-align: left;
    margin: 1rem 0;
}

/* Status Alert Message */
.status-message {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.status-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

/* Spinner Loader */
.loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1.5rem;
}
