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

:root {
    --primary-green: #00c853;
    --primary-green-dark: #00a844;
    --primary-green-light: #e8f5e9;
    --gradient-start: #00c853;
    --gradient-end: #00e676;
    --white: #ffffff;
    --light-gray: #f5f7fa;
    --border-color: #e0e6ed;
    --text-dark: #1a1a2e;
    --text-medium: #4a4a68;
    --text-light: #8e8ea0;
    --status-success: #00c853;
    --status-failure: #ff5252;
    --status-pending: #ffab00;
    --type-physical: #2979ff;
    --type-digital: #7c4dff;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
    --shadow-green: 0 4px 20px rgba(0,200,83,0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- Global & Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #f5f7fa 0%, #e8f5e9 100%);
    color: var(--text-dark);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
}

main.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    min-height: calc(100vh - 200px); /* Ensure footer stays down */
}

article {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

article:hover {
    box-shadow: var(--shadow-md);
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: var(--text-dark);
}

h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }

a {
    color: var(--primary-green);
    text-decoration: none;
    transition: var(--transition);
}
a:hover {
    color: var(--primary-green-dark);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

hr {
    border: none;
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}

/* --- Navigation --- */
nav.top-nav {
    background: var(--white);
    padding: 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav.top-nav .nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

nav.top-nav .brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-green-dark);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

nav.top-nav .brand:hover {
    color: var(--primary-green);
    transform: scale(1.02);
}

nav.top-nav .nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

nav.top-nav .nav-links a {
    color: var(--text-medium);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

nav.top-nav .nav-links a:hover {
    background: var(--light-gray);
    color: var(--primary-green-dark);
}

nav.top-nav .nav-links a.active {
    background: var(--primary-green-light);
    color: var(--primary-green-dark);
}

nav.top-nav .nav-links a.btn-nav {
    background: var(--primary-green);
    color: var(--white);
    border: none;
    box-shadow: var(--shadow-green);
}

nav.top-nav .nav-links a.btn-nav:hover {
    background: var(--primary-green-dark);
    color: var(--white);
    transform: translateY(-1px);
}

nav.top-nav .nav-links a.btn-nav-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-medium);
}

nav.top-nav .nav-links a.btn-nav-outline:hover {
    background: var(--light-gray);
    border-color: var(--primary-green);
    color: var(--primary-green-dark);
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-dark);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    nav.top-nav .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
    }
    
    nav.top-nav .nav-links.active {
        display: flex;
    }
    
    nav.top-nav .nav-links a {
        width: 100%;
        justify-content: center;
        padding: 0.75rem;
    }
}

/* --- Buttons --- */
button, a[role="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--white);
    text-align: center;
    cursor: pointer;
    user-select: none;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-decoration: none;
    box-shadow: var(--shadow-green);
    position: relative;
    overflow: hidden;
}

button:hover, a[role="button"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0,200,83,0.4);
    color: var(--white);
    text-decoration: none;
}

button:active, a[role="button"]:active {
    transform: translateY(0);
}

button.secondary, a[role="button"].secondary {
    color: var(--primary-green);
    background: var(--white);
    border: 2px solid var(--primary-green);
    box-shadow: none;
}

button.secondary:hover, a[role="button"].secondary:hover {
    background: var(--primary-green-light);
    box-shadow: none;
    color: var(--primary-green-dark);
}

button.danger, a[role="button"].danger {
    color: var(--white);
    background: linear-gradient(135deg, #ff5252 0%, #d32f2f 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(255, 82, 82, 0.3);
}

button.danger:hover, a[role="button"].danger:hover {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    box-shadow: 0 6px 20px rgba(255, 82, 82, 0.45);
    color: var(--white);
}

/* --- Product Type Switcher --- */
.type-selector-card {
    background: var(--light-gray);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.type-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.75rem;
}

.type-radio-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--white);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.type-radio-label:hover {
    border-color: var(--primary-green);
    background: var(--primary-green-light);
}

.type-radio-label input[type="radio"] {
    margin: 0;
    accent-color: var(--primary-green);
    transform: scale(1.2);
}

.type-radio-label.active-physical {
    border-color: var(--type-physical);
    background: #e3f2fd;
    color: #0d47a1;
}

.type-radio-label.active-digital {
    border-color: var(--type-digital);
    background: #ede7f6;
    color: #4a148c;
}

/* --- Form Field Groups --- */
.form-section-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.form-section-card.section-physical {
    border-left: 5px solid var(--type-physical);
}

.form-section-card.section-digital {
    border-left: 5px solid var(--type-digital);
}

.form-section-card.section-common {
    border-left: 5px solid var(--primary-green);
}

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

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

@media (max-width: 650px) {
    .type-options-grid, .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
}

.badge-physical {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid rgba(25, 118, 210, 0.2);
}

.badge-digital {
    background: #ede7f6;
    color: #673ab7;
    border: 1px solid rgba(103, 58, 183, 0.2);
}

.badge-category {
    background: #f1f3f5;
    color: #495057;
    border: 1px solid #ced4da;
}

.badge-stock {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid rgba(46, 125, 50, 0.2);
}

.badge-stock-out {
    background: #ffebee;
    color: #c62828;
    border: 1px solid rgba(198, 40, 40, 0.2);
}

/* --- Product Cards Enhancements --- */
.product-card .card-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    z-index: 2;
}

.product-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    padding: 0.4rem 0.6rem;
    background: var(--light-gray);
    border-radius: var(--radius-sm);
}

/* --- Delete Warning Box --- */
.delete-confirm-box {
    border: 2px solid #ff5252;
    background: #fff8f8;
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    max-width: 600px;
    margin: 2rem auto;
}

.delete-product-summary {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin: 1.5rem 0;
    text-align: left;
}

.delete-product-summary img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* --- Forms --- */
form {
    margin-top: 1rem;
}

form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="tel"],
form input[type="url"],
form input[type="number"],
form textarea,
form select {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-dark);
    background-color: var(--light-gray);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    margin-bottom: 1rem;
    font-family: var(--font-family);
}

form input:focus, form textarea:focus, form select:focus {
    color: var(--text-dark);
    background-color: var(--white);
    border-color: var(--primary-green);
    outline: 0;
    box-shadow: 0 0 0 4px rgba(0,200,83,0.15);
}

form small {
    display: block;
    margin-top: -0.75rem;
    margin-bottom: 1rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* --- Alerts / Notices --- */
.notice, .success {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease-out;
}

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

.notice {
    color: #c62828;
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 4px solid #c62828;
}

.success {
    color: #2e7d32;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-left: 4px solid #2e7d32;
}

/* --- Product Grid & Cards --- */
.grid {
    display: grid;
    grid-gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.product-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-align: center;
    padding: 0;
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    opacity: 0;
    transition: var(--transition);
}

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

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

.product-card .card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--light-gray);
    position: relative;
}

.product-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .card-image img {
    transform: scale(1.05);
}

.product-card .card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card header {
    padding: 0 0 0.5rem;
}

.product-card header h5 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.product-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    min-height: 40px;
    margin-bottom: 1rem;
    line-height: 1.5;
    flex: 1;
}

.product-card footer {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--light-gray);
}

.product-card footer strong {
    font-size: 1.4rem;
    color: var(--primary-green-dark);
    font-weight: 800;
    display: block;
    margin-bottom: 0.75rem;
}

.product-card form {
    margin: 0;
}

.product-card button {
    width: 100%;
    padding: 0.85rem;
    font-size: 0.95rem;
}

/* --- Tables --- */
figure {
    margin: 0;
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-dark);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

th, td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    text-align: left;
}

thead th {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: var(--white);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background-color: var(--primary-green-light);
}

tbody td {
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

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

.status-success { 
    font-weight: 700; 
    color: var(--status-success);
    background: rgba(0,200,83,0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-block;
}

.status-failure { 
    font-weight: 700; 
    color: var(--status-failure);
    background: rgba(255,82,82,0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-block;
}

.status-pending { 
    font-weight: 700; 
    color: var(--status-pending);
    background: rgba(255,171,0,0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-block;
}

/* --- Admin Layout --- */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.admin-content {
    min-width: 0;
}

@media (max-width: 820px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .admin-sidebar {
        position: static;
        margin-bottom: 1.5rem;
    }
}

.admin-sidebar {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: sticky;
    top: 80px;
}

.admin-sidebar .sidebar-header {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: var(--white);
    padding: 1.25rem;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-sidebar ul {
    list-style: none;
    padding: 0.5rem;
    margin: 0;
}

.admin-sidebar ul li {
    margin-bottom: 0.25rem;
}

.admin-sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-medium);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.admin-sidebar ul li a:hover {
    background: var(--primary-green-light);
    color: var(--primary-green-dark);
    text-decoration: none;
}

.admin-sidebar ul li a.active {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: var(--white);
    box-shadow: var(--shadow-green);
}

.admin-sidebar ul li a .feather {
    width: 18px;
    height: 18px;
}

/* --- Dashboard Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--primary-green-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--primary-green);
}

.stat-card .stat-icon .feather {
    width: 24px;
    height: 24px;
}

.stat-card h4 {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
}

/* --- Page Header --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    margin-bottom: 0;
}

/* --- Icon Styling --- */
.feather {
    vertical-align: -0.2em;
    margin-right: 0.3em;
    width: 16px;
    height: 16px;
}

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 3rem 0 2rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.85rem;
    background: var(--white);
}

.site-footer p {
    margin-bottom: 0.5rem;
}

.site-footer a {
    color: var(--primary-green);
    font-weight: 600;
    transition: var(--transition);
}

.site-footer a:hover {
    color: var(--primary-green-dark);
    text-decoration: underline;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-light);
}

.empty-state .feather {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-medium);
    margin-bottom: 0.5rem;
}

@media (max-width: 480px) {
    main.container {
        padding: 0 1rem 2rem;
    }
    article {
        padding: 1.5rem;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .grid {
        grid-template-columns: 1fr;
    }
    h2 {
        font-size: 1.5rem;
    }
}
</style>