/* 
 * Modern Style CSS - Multi-Product Management System
 * LAB 5 Quiz Project V2 - Dark Theme with Animations
 */

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

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --accent: #f093fb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border-color: #334155;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);

    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    opacity: 0.05;
    z-index: -1;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 40px;
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120"><path d="M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V0H0V27.35A600.21,600.21,0,0,0,321.39,56.44Z" fill="rgba(255,255,255,0.1)"/></svg>') no-repeat bottom;
    opacity: 0.3;
}

.header h1 {
    font-size: 3em;
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 2px 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.header p {
    font-size: 1.2em;
    opacity: 0.95;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

/* Navigation */
.nav {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    animation: slideUp 0.6s ease-out 0.1s both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--radius);
    transition: var(--transition);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.nav a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.nav a:hover::before {
    width: 300px;
    height: 300px;
}

.nav a:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.nav a.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Content */
.content {
    animation: slideUp 0.7s ease-out 0.2s both;
}

/* Dashboard Grid */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    animation: scaleIn 0.5s ease-out both;
    animation-delay: calc(var(--card-index) * 0.1s);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--card-gradient, linear-gradient(90deg, var(--primary), var(--secondary)));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s ease;
}

.card:hover::before {
    transform: scaleX(1);
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.card h3 {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.card .number {
    font-size: 3em;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--card-gradient, linear-gradient(135deg, var(--primary), var(--secondary)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card p {
    color: var(--text-secondary);
    font-size: 0.95em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-size: 1em;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 400px;
    height: 400px;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.5);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.5);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    animation: slideUp 0.7s ease-out 0.3s both;
}

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

thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

thead th {
    padding: 18px;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 1px;
    color: white;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

tbody tr:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.01);
}

tbody td {
    padding: 18px;
    color: var(--text-secondary);
}

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

/* Product Image */
.product-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    object-fit: cover;
    border: 2px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.product-image:hover {
    transform: scale(1.5);
    box-shadow: var(--shadow);
    z-index: 10;
}

.no-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    border: 2px solid var(--border-color);
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95em;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1em;
    transition: var(--transition);
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: var(--bg-card);
}

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

/* File Upload */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-secondary);
}

.file-upload:hover {
    border-color: var(--primary);
    background: var(--bg-card);
}

.file-upload.dragover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.upload-icon {
    font-size: 3em;
    color: var(--primary);
}

.image-preview {
    margin-top: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 300px;
    animation: fadeIn 0.5s ease;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* Alert Messages */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-weight: 500;
    border-left: 4px solid;
    animation: slideInRight 0.5s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: var(--success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: var(--danger);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border-color: var(--info);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Price */
.price {
    font-weight: 700;
    color: var(--success);
    font-size: 1.1em;
}

/* Stock Badge */
.stock-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

.stock-high {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 2px solid var(--success);
}

.stock-medium {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 2px solid var(--warning);
}

.stock-low {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 2px solid var(--danger);
}

/* Category Badge */
.category-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
    background: rgba(102, 126, 234, 0.2);
    color: var(--primary);
    border: 2px solid var(--primary);
}

/* Footer */
.footer {
    background: var(--bg-card);
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
    border-radius: var(--radius);
    animation: slideUp 0.8s ease-out 0.4s both;
}

/* Loading Spinner */
.spinner {
    border: 4px solid var(--bg-tertiary);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: toastSlide 0.5s ease;
    max-width: 400px;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(400px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Search & Filter */
.search-container {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-container input,
.search-container select {
    flex: 1;
    min-width: 200px;
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }

    .nav {
        flex-direction: column;
    }

    .nav a {
        text-align: center;
    }

    .dashboard {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    table {
        font-size: 0.85em;
    }

    thead th,
    tbody td {
        padding: 12px;
    }

    .search-container {
        flex-direction: column;
    }

    .search-container input,
    .search-container select {
        width: 100%;
    }
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Selection */
::selection {
    background: var(--primary);
    color: white;
}