/* ==========================================================================
   AGENCIAWEB360 / IGLOBALIA - WPGuard SaaS Design System & Styles
   Mobile-First, Glassmorphism Aesthetic, Dark & Light (Day Mode) Responsive System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* Default Dark Theme Variables */
:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(18, 26, 43, 0.85);
    --bg-card-hover: rgba(26, 38, 64, 0.9);
    --bg-input: rgba(13, 20, 36, 0.9);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-highlight: rgba(0, 240, 255, 0.3);
    
    --primary: #00f0ff;
    --primary-glow: rgba(0, 240, 255, 0.25);
    --secondary: #7000ff;
    --secondary-glow: rgba(112, 0, 255, 0.25);
    --accent: #ff007a;
    
    --success: #00e676;
    --success-bg: rgba(0, 230, 118, 0.12);
    --warning: #ffab00;
    --warning-bg: rgba(255, 171, 0, 0.12);
    --danger: #ff1744;
    --danger-bg: rgba(255, 23, 68, 0.12);
    --info: #29b6f6;
    
    --text-main: #f3f6fc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(0, 240, 255, 0.2);
    
    --header-height: 65px;
    --sidebar-width: 260px;
    --bg-gradient: radial-gradient(circle at 10% 20%, rgba(112, 0, 255, 0.15) 0%, transparent 40%),
                   radial-gradient(circle at 90% 80%, rgba(0, 240, 255, 0.12) 0%, transparent 40%);
}

/* Light / Day Mode (Modo Día) Color Variables Override */
[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --bg-input: #ffffff;
    --border-color: rgba(0, 0, 0, 0.12);
    --border-highlight: rgba(0, 150, 255, 0.4);
    
    --primary: #0284c7;
    --primary-glow: rgba(2, 132, 199, 0.2);
    --secondary: #6366f1;
    --secondary-glow: rgba(99, 102, 241, 0.2);
    --accent: #ec4899;
    
    --success: #16a34a;
    --success-bg: rgba(22, 163, 74, 0.12);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.12);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.12);
    --info: #0284c7;
    
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #64748b;
    
    --shadow-glass: 0 10px 30px rgba(0, 0, 0, 0.07);
    --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.15);
    --bg-gradient: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
                   radial-gradient(circle at 90% 80%, rgba(2, 132, 199, 0.08) 0%, transparent 40%);
}

/* Strict Box Sizing & Mobile Horizontal Overflow Prevention */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism Containers */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glass);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
}

/* Mobile Off-Canvas Sidebar Navigation */
.mobile-top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1001;
    width: 100%;
}

@media (min-width: 992px) {
    .mobile-top-header {
        display: none;
    }
}

.btn-hamburger {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    bottom: 0;
    width: 270px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(25px);
    display: flex;
    flex-direction: column;
    z-index: 1200;
    transition: left 0.3s ease-in-out;
    box-shadow: var(--shadow-glass);
}

.sidebar.active {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

@media (min-width: 992px) {
    .sidebar {
        left: 0;
        width: var(--sidebar-width);
        min-height: 100vh;
        z-index: 100;
        box-shadow: none;
    }
    .sidebar-overlay {
        display: none !important;
    }
}

.brand-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
}

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

.nav-menu {
    list-style: none;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item a:hover, .nav-item.active a {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--primary);
}

[data-theme="dark"] .nav-item a:hover, [data-theme="dark"] .nav-item.active a {
    background: rgba(255, 255, 255, 0.06);
}

.nav-item a svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

@media (min-width: 992px) {
    .main-content {
        margin-left: var(--sidebar-width);
        padding: 2rem 2.25rem;
        gap: 1.75rem;
    }
}

/* Header / Navbar */
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

@media (max-width: 640px) {
    .top-navbar {
        flex-direction: column;
        align-items: stretch;
    }
}

.page-title h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    word-break: break-word;
}

@media (min-width: 768px) {
    .page-title h1 {
        font-size: 1.75rem;
    }
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    padding: 0.4rem 0.85rem;
    border-radius: 40px;
    border: 1px solid var(--border-color);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 0.9rem;
}

/* Theme Switcher Toggle Button */
.btn-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border-radius: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-theme-toggle:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1rem;
    width: 100%;
}

@media (min-width: 576px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.kpi-card {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kpi-info h3 {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}

.kpi-info .value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 132, 199, 0.1);
    color: var(--primary);
    flex-shrink: 0;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-info    { background: rgba(2, 132, 199, 0.12); color: var(--primary); }

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

/* Builder & Plugin Tags */
.tag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

[data-theme="dark"] .tag {
    background: rgba(255, 255, 255, 0.08);
}

.tag-elementor { background: rgba(146, 39, 143, 0.15); color: #c026d3; border: 1px solid rgba(192, 38, 211, 0.3); }
.tag-woocommerce { background: rgba(150, 88, 138, 0.15); color: #9333ea; border: 1px solid rgba(147, 51, 234, 0.3); }
.tag-wpbakery { background: rgba(247, 148, 29, 0.15); color: #d97706; border: 1px solid rgba(217, 119, 6, 0.3); }

/* Data Tables & Clean URL Styling */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.5rem;
    display: block;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
    min-width: 580px;
}

.data-table th {
    background: rgba(0, 0, 0, 0.03);
    padding: 0.85rem 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

[data-theme="dark"] .data-table th {
    background: rgba(13, 20, 36, 0.6);
}

.data-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-main);
    white-space: nowrap; /* Prevents character-by-character vertical breaking */
}

.data-table tr:last-child td {
    border-bottom: none;
}

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

[data-theme="dark"] .data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Single-Line Clean URL Links in Tables */
.table-url-link {
    display: inline-block;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.table-url-link:hover {
    text-decoration: underline;
}

/* Break long strings/JSON text inside Activity Logs */
.log-detail-text {
    word-break: break-all;
    overflow-wrap: anywhere;
    white-space: normal;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Forms & Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.1rem;
    width: 100%;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-align: center;
}

@media (max-width: 640px) {
    .btn-responsive-full {
        width: 100%;
    }
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(2, 132, 199, 0.35);
}

.btn-secondary {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .btn-secondary {
    background: rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
}

/* Responsive Action Toolbar */
.action-toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
}

@media (max-width: 640px) {
    .action-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .action-toolbar .btn {
        width: 100%;
    }
}

/* App Footer ("by IGLOBALIA") */
.app-footer {
    margin-top: auto;
    padding: 1.5rem 0 0.5rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.app-footer a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}
