:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc; /* Sophisticated slate-white */
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: rgba(148, 163, 184, 0.2);
    
    /* Elegant Purples */
    --primary-purple: #7e22ce;
    --primary-purple-hover: #581c87;
    --sidebar-purple: #4c1d95; /* Deep, rich purple for the fixed sidebar */
    
    /* Micro-Radiuses */
    --radius-sm: 4px;
    --radius-md: 6px; /* Slightly softer than 2px but still sharp, perfect for 1000$ look */
    
    /* Layered Box Shadows mimicking physical depth */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-purple: 0 4px 14px 0 rgba(126, 34, 206, 0.25);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography Refinements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

a {
    color: var(--primary-purple);
    text-decoration: none;
    transition: color var(--transition-fast);
}

/* Auth Layout */
.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-secondary);
    background-image: radial-gradient(circle at top right, rgba(126,34,206,0.05), transparent 400px);
}

.auth-card {
    background-color: var(--bg-primary);
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.auth-card h2 {
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 1.75rem;
}

.auth-card p.subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: 1rem;
}

/* Form Styling */
.auth-form-group {
    margin-bottom: 1.5rem;
}

.auth-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.auth-form-group input, 
.auth-form-group textarea,
#crud-form input,
#crud-form textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-fast);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.auth-form-group input:focus,
.auth-form-group textarea:focus,
#crud-form input:focus,
#crud-form textarea:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(126, 34, 206, 0.1), inset 0 1px 2px rgba(0,0,0,0.02);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 2.5rem; /* space for icon */
}

.eye-icon {
    position: absolute;
    right: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.eye-icon:hover {
    color: var(--primary-purple);
}

/* Premium Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    text-align: center;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-smooth);
    border: none;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(180deg, var(--primary-purple) 0%, var(--primary-purple-hover) 100%);
    color: white;
    box-shadow: var(--shadow-purple);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(126, 34, 206, 0.35);
}

.btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px 0 rgba(126, 34, 206, 0.25);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background-color: #f1f5f9;
}

.btn-block {
    width: 100%;
}

.auth-switch {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-switch a {
    font-weight: 600;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* High-End Dashboard Layout */
.dashboard-layout {
    display: flex;
}

/* Sidebar styling mimicking modern enterprise SaaS */
.sidebar {
    width: 260px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    background-color: var(--sidebar-purple);
    background-image: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    border-right: none;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 1.75rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header h2 {
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: inset 3px 0 0 #ffffff;
}

/* Main Body & Glassmorphism Header */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    background-color: var(--bg-secondary);
    width: calc(100% - 260px);
}

.header {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: 72px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2.5rem;
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    z-index: 90;
    /* Subtle shadow pushing off the frosted glass */
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.02);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.content-body {
    margin-top: 72px;
    padding: 2.5rem;
}

/* Data Structuring - Cards & Tables */
.card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    font-size: 1.125rem;
}

/* Elegant Table Design */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th, td {
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: #f8fafc;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

th:first-child { border-top-left-radius: var(--radius-sm); }
th:last-child { border-top-right-radius: var(--radius-sm); }

tr {
    transition: background-color var(--transition-fast);
}

tr:hover td {
    background-color: #fbfbfc;
}

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

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

/* Interactive Data Grid / Image Cards */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.item-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

/* Micro-interaction: Card Lift */
.item-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.item-img-wrapper {
    height: 160px;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.item-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.item-card:hover .item-img-wrapper img {
    transform: scale(1.05); /* Slight zoom on hover */
}

.item-card-body {
    padding: 1.25rem;
    flex: 1;
}

.item-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.item-card-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.item-card-actions {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    background-color: #fafafa;
}

/* Premium Modals with Frosted Backdrop */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background-color: #fafafa;
}

/* Sleek Alerts */
.alert-popup-content {
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 400px;
    text-align: center;
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--primary-purple);
    transform: scale(0.9);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15) forwards;
}

.alert-popup-content.error {
    border-top-color: #ef4444;
}

.alert-popup-content.success {
    border-top-color: #10b981;
}

.alert-popup-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.alert-popup-msg {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

@keyframes popIn {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
