/* ==========================================================================
   WEBOOK ROTATOR - MODERN DARK GLASSMORPHISM STYLESHEET
   ========================================================================== */

:root {
    --bg-dark: #0a0d14;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-hover: rgba(28, 36, 56, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(0, 242, 254, 0.3);
    
    --primary: #00f2fe;
    --primary-glow: rgba(0, 242, 254, 0.25);
    --secondary: #4facfe;
    --accent-purple: #7928ca;
    --accent-pink: #ff007f;
    --accent-green: #00f5d4;
    --accent-amber: #ffb703;
    --accent-red: #ff4757;

    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-glow: 0 0 20px rgba(0, 242, 254, 0.15);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(121, 40, 202, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 242, 254, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(255, 0, 127, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism Common */
.glass-card, .glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-glass);
    border-radius: var(--radius-lg);
}

/* Helper Utilities */
.hidden { display: none !important; }
.flex-gap { display: flex; gap: 0.75rem; align-items: center; }
.margin-top { margin-top: 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.code-editor {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    background: rgba(10, 13, 20, 0.9) !important;
    color: #00f2fe;
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    line-height: 1.5;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #040914;
    box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(255, 71, 87, 0.15);
    color: var(--accent-red);
    border-color: rgba(255, 71, 87, 0.3);
}
.btn-danger:hover {
    background: rgba(255, 71, 87, 0.25);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    padding: 0;
    font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }

.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-icon:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

/* AUTH LOGIN SCREEN */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}
.brand-badge {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent-purple), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 25px rgba(121, 40, 202, 0.4);
}

.auth-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}
.auth-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon-wrapper svg {
    position: absolute;
    left: 1rem;
    color: var(--text-dim);
}
.input-icon-wrapper input, .form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    background: rgba(10, 13, 20, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:not(.input-icon-wrapper input), .form-group select, .form-group textarea {
    padding-left: 1rem;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.auth-footer {
    margin-top: 1.75rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
}
.security-tag {
    font-size: 0.75rem;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* APP LAYOUT */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    border-radius: 0;
    border-right: 1px solid var(--border-color);
    border-top: none; border-bottom: none; border-left: none;
    height: 100vh;
    position: sticky;
    top: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    margin-bottom: 2rem;
}
.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
}
.brand-title .name {
    display: block;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}
.brand-title .tag {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--primary);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}
.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.04);
}
.nav-item.active {
    color: var(--primary);
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.15);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}
.user-pill {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-purple);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}
.user-info .uname {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
}
.user-info .urole {
    display: block;
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-radius: 0;
    border-bottom: 1px solid var(--border-color);
    border-top: none; border-left: none; border-right: none;
}
.header-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.status-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

.status-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Content Body & Tabs */
.content-body {
    padding: 2rem;
    flex: 1;
}

.tab-page {
    display: none;
}
.tab-page.active {
    display: block;
    animation: fadeIn 0.25s ease-in-out;
}

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

.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}
.page-title-row h2 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Metrics Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.metric-card {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform 0.2s;
}
.metric-card:hover { transform: translateY(-3px); }

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-blue { background: rgba(0, 242, 254, 0.12); color: var(--primary); }
.icon-green { background: rgba(0, 245, 212, 0.12); color: var(--accent-green); }
.icon-amber { background: rgba(255, 183, 3, 0.12); color: var(--accent-amber); }
.icon-purple { background: rgba(121, 40, 202, 0.15); color: #a855f7; }

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.metric-value {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 0.15rem;
}

/* Panels & Tables */
.panel {
    padding: 1.5rem;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.panel-header h3 { font-size: 1.1rem; font-weight: 700; }

.table-responsive {
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}
.data-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    font-size: 0.725rem;
    font-weight: 700;
    border-radius: 9999px;
    letter-spacing: 0.03em;
}
.badge-success { background: rgba(0, 245, 212, 0.15); color: var(--accent-green); border: 1px solid rgba(0, 245, 212, 0.3); }
.badge-danger { background: rgba(255, 71, 87, 0.15); color: var(--accent-red); border: 1px solid rgba(255, 71, 87, 0.3); }
.badge-accent { background: rgba(0, 242, 254, 0.15); color: var(--primary); border: 1px solid rgba(0, 242, 254, 0.3); }
.badge-purple { background: rgba(121, 40, 202, 0.2); color: #c084fc; border: 1px solid rgba(121, 40, 202, 0.3); }

/* Rules Cards Grid */
.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.rule-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color 0.2s, transform 0.2s;
}
.rule-card:hover {
    border-color: var(--border-highlight);
    transform: translateY(-3px);
}
.rule-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.rule-title-group h3 { font-size: 1.15rem; font-weight: 700; }
.rule-slug {
    font-family: var(--font-mono);
    font-size: 0.775rem;
    color: var(--primary);
    margin-top: 0.2rem;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 24px;
}
.slider:before {
    position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); background-color: #000; }

.targets-summary {
    background: rgba(10, 13, 20, 0.5);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    margin: 1rem 0;
}
.target-item {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
.target-item:last-child { border-bottom: none; }

/* Tester Grid */
.tester-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .tester-grid { grid-template-columns: 1fr; }
    .sidebar { width: 80px; padding: 1rem 0.5rem; }
    .brand-title, .nav-item span, .sidebar-footer .user-info { display: none; }
}

.test-result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-dim);
    text-align: center;
    gap: 1rem;
}

/* Security Grid */
.security-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.security-features-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1rem;
}
.security-features-list li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(4, 7, 14, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1.5rem;
}

.modal-content {
    width: 100%;
    padding: 1.75rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.max-w-2xl { max-width: 650px; }
.max-w-3xl { max-width: 800px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.modal-close {
    background: none; border: none;
    color: var(--text-muted);
    font-size: 1.5rem; cursor: pointer;
}
.modal-close:hover { color: var(--text-main); }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 1rem 0;
    font-size: 0.85rem;
}

/* Target Builder Rows */
.targets-section {
    background: rgba(10, 13, 20, 0.4);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}
.targets-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.target-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}
.target-row input { flex: 1; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
.alert-error {
    background: rgba(255, 71, 87, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(255, 71, 87, 0.3);
}
.alert-success {
    background: rgba(0, 245, 212, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(0, 245, 212, 0.3);
}
