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

:root {
    /* Strict Color Palette */
    --bg-color: #0B1120;
    --glass-bg: #131B2E;
    --glass-hover: #1A2338;
    --glass-border: #232C42;
    
    --primary-color: #6366F1;
    --primary-hover: #7C7FF5;
    --primary-muted: rgba(99, 102, 241, 0.15);
    
    --text-main: #FFFFFF;
    --text-muted: #94A3B8;
    
    --sidebar-width: 250px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--glass-bg);
    border-right: 1px solid var(--glass-border);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
}

.sidebar.collapsed {
    width: 80px;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 24px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    white-space: nowrap;
}

.brand-text {
    transition: opacity 0.3s;
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

#btn-toggle-sidebar {
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
#btn-toggle-sidebar:hover {
    color: var(--text-main);
}
.sidebar.collapsed #btn-toggle-sidebar {
    margin: 0 auto;
}

.nav-links {
    list-style: none;
    padding: 0 16px;
}

.nav-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 16px;
}

.nav-links li {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    position: relative;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
}

.nav-text {
    transition: opacity 0.3s;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
}

.sidebar.collapsed .nav-links li {
    padding: 12px;
    justify-content: center;
}

.sidebar.collapsed .nav-links li.folder {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

.nav-links li.folder {
    cursor: default;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    padding: 8px 16px;
    margin-bottom: 4px;
}

.nav-links li:not(.folder):hover {
    background: var(--glass-hover);
    color: var(--text-main);
}

.nav-links li:not(.folder):hover svg {
    stroke: var(--text-main);
}

.nav-links li.active {
    background: var(--primary-muted);
    color: var(--primary-color);
}

.nav-links li.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background-color: var(--primary-color);
    border-radius: 0 4px 4px 0;
}

.sidebar.collapsed .nav-links li.active::before {
    left: 0;
}

.nav-links li svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-muted);
    transition: stroke 0.2s ease;
    flex-shrink: 0;
}

.nav-links li.active svg {
    stroke: var(--primary-color);
}

/* Main Content */
.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.view.active {
    display: block;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

h1, h2, h3 {
    margin-bottom: 16px;
    color: var(--text-main);
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.3;
}

h3 {
    font-size: 1.25rem;
    font-weight: 500;
}

/* Cards & Surfaces */
.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.card {
    padding: 24px;
    margin-bottom: 24px;
}

/* Typography & Utils */
.text-muted {
    color: var(--text-muted);
}

.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-8 { margin-top: 8px; }
.w-100 { width: 100%; }

/* Dashboard UI */
.hero-header {
    text-align: center;
    margin-bottom: 48px;
    margin-top: 24px;
}

.hero-header h2 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.hero-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.action-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.action-card {
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 24px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-card:hover {
    background: var(--glass-hover);
    transform: translateY(-2px);
    border-color: var(--primary-muted);
}

.ac-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 24px;
    background: var(--primary-muted);
    padding: 12px;
    border-radius: 8px;
}

.ac-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--primary-color);
}

.ac-text {
    flex-grow: 1;
}

.ac-text h3 {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.ac-text p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.ac-arrow {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}
.ac-arrow svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn.primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn.primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
    transform: translateY(-1px);
}

.btn.secondary {
    background: transparent;
    border-color: var(--glass-border);
    color: var(--text-main);
}

.btn.secondary:hover {
    background: var(--glass-hover);
    border-color: var(--text-muted);
}

/* Inputs & Selects */
input, select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

input:focus, select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-muted);
}

/* Rules List (Table Rows/Cards) */
.rules-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rule-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    transition: background 0.2s;
}

.rule-card:hover {
    background: var(--glass-hover);
}

.rule-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rule-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-main);
}

.rule-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.rule-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge.active {
    background: var(--primary-muted);
    color: var(--primary-color);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 17, 32, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    padding: 32px;
    width: 90%;
    max-width: 440px;
    background: var(--bg-color); /* Overwrite glass for solid modal */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

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

/* Animated Background */
.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background-color: var(--bg-color);
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out alternate;
}

.glow-orb-1 {
    width: 600px;
    height: 600px;
    background: rgba(99, 102, 241, 0.15); /* primary color */
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.glow-orb-2 {
    width: 500px;
    height: 500px;
    background: rgba(139, 92, 246, 0.15); /* subtle purple */
    bottom: -20%;
    right: -10%;
    animation-delay: -5s;
    animation-duration: 25s;
}

.glow-orb-3 {
    width: 400px;
    height: 400px;
    background: rgba(59, 130, 246, 0.1); /* subtle blue */
    top: 40%;
    left: 60%;
    animation-delay: -10s;
    animation-duration: 30s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
    100% {
        transform: translate(0, 0) scale(1);
    }
}
