:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #64748b;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme='dark'] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    transition: var(--transition);
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 2rem 0;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 0 2rem 2.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    color: var(--primary);
}

.logo span span {
    color: var(--primary);
}

.nav-menu {
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 2rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--sidebar-active);
    border-left-color: var(--primary);
}

.user-profile {
    padding: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info .name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
}

.user-info .role {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 2rem;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.search-bar {
    background: var(--bg-card);
    padding: 0.6rem 1.2rem;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--border);
    width: 350px;
    box-shadow: var(--shadow);
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--text-main);
}

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

/* Buttons */
.primary-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.secondary-btn {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.secondary-btn:hover {
    background-color: var(--bg-body);
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Dashboard */
.welcome-banner {
    margin-bottom: 2.5rem;
}

.welcome-banner h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.purple { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.stat-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.stat-icon.orange { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.stat-icon.green { background: rgba(16, 185, 129, 0.1); color: #10b981; }

.stat-info .label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Forms */
.card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.dynamic-form {
    margin-top: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
    padding: 0.85rem 1.2rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-body);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1.1rem;
    transition: var(--transition);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input { display: none; }

.toggle-switch label {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    border-radius: 34px;
    cursor: pointer;
    transition: .4s;
}

.toggle-switch label:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 4px; bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

.toggle-switch input:checked + label { background-color: var(--success); }
.toggle-switch input:checked + label:before { transform: translateX(24px); }

.form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Views Management */
.view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.view.active {
    display: block;
}

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

/* Definitions Layout */
.def-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-btn {
    padding: 0.6rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.def-flex {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.def-form h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.def-form input {
    width: 100%;
    padding: 1.5rem 2rem;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    background: var(--bg-body);
    color: var(--text-main);
    transition: var(--transition);
    font-weight: 500;
}

.def-form input::placeholder {
    font-size: 1.25rem;
    opacity: 0.6;
}

.def-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.def-form .primary-btn {
    width: 100%;
    justify-content: center;
    padding: 1.2rem;
    font-size: 1.3rem;
}

.def-list ul {
    list-style: none;
}

.def-list li {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.def-list li:last-child { border-bottom: none; }

/* Table */
.table-responsive {
    overflow-x: auto;
    margin-top: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.success { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge.warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.action-btn.delete:hover { color: var(--danger); }

/* Notifications */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.notification {
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Animations */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

@media (max-width: 992px) {
    .sidebar { width: 80px; }
    .logo span, .user-info, .nav-item span { display: none; }
    .main-content { margin-left: 80px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.full-width { grid-column: span 1; }
    .def-flex { grid-template-columns: 1fr; }
}
