/* 
 * Modern Admin Design System
 * Inspired by: https://www.figma.com/community/file/1153320445661469840/sales-dashboard-design
 * 
 * Future AI Instructions: 
 * Always use the CSS variables below for styling. 
 * Maintain the 20px card border-radius and 12px sidebar border-radius.
 * Use Poppins or Inter for typography.
 */

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

:root {
    /* Color Palette */
    --primary: #5D5FEF;
    --primary-light: #EBEBFF;
    --success: #00E096;
    --success-light: #E0FFF3;
    --warning: #FFCF00;
    --danger: #FA5A7D;
    --danger-light: #FFE0E6;
    
    /* Backgrounds */
    --bg-page: #F8F9FA;
    --bg-card: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-input: #F3F4F6;
    
    /* Text */
    --text-main: #151B33;
    --text-muted: #737791;
    --text-white: #FFFFFF;
    
    /* Borders & Shadows */
    --border-color: #EFF0F6;
    --shadow-soft: 0px 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0px 10px 30px rgba(0, 0, 0, 0.08);
    
    /* Spacing & Radius */
    --radius-card: 20px;
    --radius-btn: 12px;
    --radius-input: 12px;
    --sidebar-width: 260px;
    --header-height: 80px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-width: 0;
    width: calc(100vw - var(--sidebar-width));
    max-width: calc(100vw - var(--sidebar-width));
}

.topbar {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

/* Components */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    max-width: 100%;
}

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

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

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

.text-muted {
    color: var(--text-muted);
}

.text-break {
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navigation */
.nav-list {
    list-style: none;
    margin-top: 40px;
}

.nav-item {
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: var(--radius-btn);
    transition: all 0.3s ease;
}

.nav-link i {
    font-size: 1.25rem;
}

.nav-link:hover, .nav-link.active {
    background: var(--primary);
    color: var(--text-white);
    box-shadow: 0 10px 20px rgba(93, 95, 239, 0.2);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-btn);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
}

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

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(93, 95, 239, 0.25);
}

.btn-success {
    background: var(--success);
    color: white;
}

/* Tables */
.table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

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

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

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

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

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-input);
    padding: 14px 18px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(93, 95, 239, 0.1);
}

.flash {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-soft);
}

.flash i {
    font-size: 1.2rem;
    line-height: 1.2;
    margin-top: 1px;
}

.flash-success {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.flash-error {
    border-color: #fda4af;
    background: #fff1f2;
    color: #be123c;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        width: 80px;
        padding: 15px;
    }
    .sidebar h2, .sidebar span {
        display: none;
    }
    .main-content {
        margin-left: 80px;
        width: calc(100vw - 80px);
        max-width: calc(100vw - 80px);
    }
    :root {
        --sidebar-width: 80px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
        padding: 20px;
        width: 100%;
        max-width: 100%;
    }
    .topbar {
        flex-direction: column;
        height: auto;
        gap: 15px;
    }
}
