/* Core Design Tokens & Root Variables */
:root {
    --bg-dark: #090d16;
    --bg-card: rgba(22, 28, 45, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(99, 102, 241, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #a855f7;
    --accent-hover: #9333ea;
    
    --success: #10b981;
    --danger: #ef4444;
    
    --font-main: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;
    
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
    --glow-indigo: 0 0 25px rgba(99, 102, 241, 0.35);
}

/* Global Reset & Base Styling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    width: 100%;
    min-height: 100vh;
    font-family: var(--font-main);
    color: var(--text-primary);
    background-color: var(--bg-dark);
    overflow-x: hidden;
    color-scheme: dark;
}

/* Stunning Background Effects */
.bg-gradient {
    background: radial-gradient(circle at 50% 50%, #111827 0%, #030712 100%);
    position: relative;
}

.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(to right, rgba(99, 102, 241, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 1;
}

/* Atmospheric Glowing Orbs */
.glowing-orb-1, .glowing-orb-2 {
    position: fixed;
    width: 40vw;
    height: 40vw;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.glowing-orb-1 {
    top: -10%;
    right: -10%;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

.glowing-orb-2 {
    bottom: -10%;
    left: -10%;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
}

/* Layout Structure */
.app-container {
    position: relative;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Main Header & Logo */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.logo-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Nav Links */
.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Main content */
.main-content {
    flex: 1;
    padding: 3rem 0;
}

/* Dashboard Home Grid */
.dashboard-title-area {
    text-align: center;
    margin-bottom: 4rem;
}

.dashboard-title-area h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
}

.dashboard-title-area p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

/* Premium Interactive Card styling */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.glass-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-hover);
    box-shadow: var(--glow-indigo);
}

.glass-card:hover::before {
    opacity: 1;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    display: inline-block;
    padding: 1rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* Premium Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--accent-hover) 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: scale(1.02);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Forms Styles */
.form-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-header h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input, .form-textarea {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    width: 100%;
}

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

.form-textarea {
    resize: vertical;
    min-height: 150px;
}

/* Items Dynamic Table Styling */
.items-section {
    margin-top: 3rem;
    margin-bottom: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

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

.items-section-header h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.items-table th {
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.items-table td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
}

.items-table tr {
    animation: fadeInRow 0.3s ease forwards;
}

/* Action Area */
.actions-area {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

/* Footer Styling */
.main-footer {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: 5rem;
}

/* Animations */
@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* File Upload Template Banner */
.template-alert {
    background: rgba(99, 102, 241, 0.1);
    border: 1px dashed rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.template-alert strong {
    color: var(--text-primary);
}

/* Responsive Tweaks */
@media(max-width: 768px) {
    .app-container {
        padding: 0 1rem;
    }
    .main-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1.5rem 0;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    .dashboard-title-area h1 {
        font-size: 2rem;
    }
    .cards-grid {
        grid-template-columns: 1fr;
    }
    .glass-card {
        padding: 1.5rem;
    }
    .form-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .items-table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1.5rem;
    }
    .items-table {
        margin-bottom: 0;
    }
    .actions-area {
        flex-direction: column-reverse;
    }
    .btn {
        width: 100%;
        justify-content: center;
    }
}
