:root {
    --primary: #4361ee;
    --primary-hover: #3a56d4;
    --secondary: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-main: #f8fafc;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --border-glass: rgba(255, 255, 255, 0.5);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --success: #10b981;
    --danger: #ef4444;
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,0) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.05) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.05) 0, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
}

/* Typography */
h1, h2, h3 {
    color: var(--text-main);
    font-weight: 600;
}

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

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-glass);
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: var(--shadow-glass);
}

.sidebar-header {
    padding: 0 2rem 2rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 1rem;
}

.sidebar-header h2 {
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
}

.nav-links {
    list-style: none;
    padding: 0 1rem;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 12px;
    transition: var(--transition);
    font-weight: 500;
}

.nav-links li.active a, .nav-links a:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    overflow-x: hidden;
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-glass);
}

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

/* Glass Card */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-glass);
    animation: fadeIn 0.5s ease;
}

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

/* Tabs */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.form-section {
    background: rgba(255, 255, 255, 0.4);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.form-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid rgba(67, 97, 238, 0.1);
    padding-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group.half {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    background: rgba(255,255,255,0.8);
    font-size: 0.95rem;
    color: var(--text-main);
    transition: var(--transition);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
    background: #fff;
}

input:disabled, select:disabled {
    background: #e2e8f0;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Currency Input Wrapper */
.input-currency {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.8);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
}

.input-currency:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
    background: #fff;
}

.input-currency .currency-symbol {
    padding: 0.75rem 0.5rem 0.75rem 1rem;
    background: rgba(0,0,0,0.02);
    color: var(--text-muted);
    font-weight: 500;
    border-right: 1px solid rgba(0,0,0,0.05);
}

.input-currency input {
    border: none;
    background: transparent;
    box-shadow: none;
}

.input-currency input:focus {
    box-shadow: none;
}

/* Radio Buttons */
.inline-radio {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.inline-radio label:first-child {
    margin-bottom: 0;
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-group input[type="radio"] {
    display: none;
}

.radio-group label {
    margin-bottom: 0;
    padding: 0.4rem 1rem;
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
}

.radio-group input[type="radio"]:checked + label {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Buttons */
.form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.4);
}

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

.btn-secondary:hover {
    background: #f1f5f9;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Table Styles */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.05);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1500px; /* Ensure horizontal scroll on small screens */
}

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 0.875rem;
}

.data-table th {
    background: rgba(241, 245, 249, 0.7);
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.data-table tbody tr {
    background: rgba(255,255,255,0.4);
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(255,255,255,0.9);
}

.btn-edit {
    padding: 0.4rem 0.8rem;
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
}

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

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

/* Loading & Toast */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(67, 97, 238, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.toast.error {
    background: var(--danger);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Responsive */
@media (max-width: 1024px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .sidebar-header {
        padding: 0;
        margin: 0;
        border: none;
    }
    
    .nav-links {
        display: flex;
        gap: 0.5rem;
    }
    
    .nav-links a {
        padding: 0.5rem 1rem;
    }
    
    .nav-links span {
        display: none; /* Hide text on mobile for nav */
    }
    
    .main-content {
        padding: 1rem;
    }
}
