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

:root {
    --primary: #2563eb;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f1f5f9;
    color: #334155;
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 24px;
    color: var(--dark);
    margin: 15px 0 5px;
}

.login-header p {
    color: var(--secondary);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Sidebar */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.05);
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.sidebar-header h2 {
    color: var(--primary);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-menu {
    padding: 20px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 25px;
    color: var(--secondary);
    text-decoration: none;
    transition: all 0.3s;
    gap: 12px;
    font-size: 15px;
}

.menu-item:hover, .menu-item.active {
    background: var(--light);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.menu-item i {
    width: 20px;
    font-size: 18px;
}

/* Main Content */
.main-content {
    margin-right: 260px;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.top-header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title h2 {
    color: var(--dark);
    font-size: 24px;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--secondary);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Dashboard */
.dashboard h1 {
    color: var(--dark);
    margin-bottom: 25px;
    font-size: 28px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-icon.green { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.stat-icon.teal { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }
.stat-icon.red { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

.stat-info h3 {
    font-size: 32px;
    color: var(--dark);
    font-weight: 700;
}

.stat-info p {
    color: var(--secondary);
    font-size: 14px;
}

/* Tables */
.recent-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 25px;
}

.recent-section h2 {
    color: var(--dark);
    margin-bottom: 20px;
    font-size: 20px;
}

.table-container {
    overflow-x: auto;
}

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

table thead {
    background: var(--light);
}

table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--border);
}

table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
}

table tbody tr:hover {
    background: var(--light);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-icon {
    padding: 8px 12px;
    background: var(--light);
    color: var(--secondary);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s;
}

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

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

.btn-secondary:hover {
    background: #475569;
}

/* Status Badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.processing {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.ordered {
    background: #e0e7ff;
    color: #3730a3;
}

.status-badge.shipped {
    background: #ddd6fe;
    color: #5b21b6;
}

.status-badge.received {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.assigned {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.on_way {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.delivered {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.busy {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

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

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-right: 4px solid var(--danger);
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-right: 4px solid var(--success);
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-right: 4px solid var(--info);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    color: var(--dark);
    font-size: 22px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--secondary);
}

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

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 45px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
}

.search-box i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform 0.3s;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: scroll;
    }
}

/* Orders Dropdown */
.order-details {
    background: #f8fafc !important;
}

.orders-dropdown {
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin: 10px;
}

.orders-dropdown h4 {
    color: var(--dark);
    margin-bottom: 15px;
    font-size: 16px;
}

.inner-table {
    width: 100%;
    background: white;
}

.inner-table thead {
    background: var(--light);
}

.inner-table th {
    padding: 10px;
    font-size: 13px;
}

.inner-table td {
    padding: 10px;
    font-size: 14px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
}

.btn-icon i {
    transition: transform 0.3s;
}

/* Search Filters */
.search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.filter-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-box label {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-box label i {
    color: var(--primary);
}

.filter-box input {
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.filter-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.search-filters .btn {
    align-self: flex-end;
    height: 42px;
}

/* Documents Page */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h1 {
    color: var(--dark);
    font-size: 28px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 20px;
}

.filter-form select,
.filter-form input {
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

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

.data-table thead {
    background: var(--light);
}

.data-table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: var(--light);
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.close {
    position: absolute;
    left: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--secondary);
    cursor: pointer;
    background: none;
    border: none;
}

.close:hover {
    color: var(--danger);
}

.modal-content {
    position: relative;
}

.modal-content h2 {
    margin-bottom: 25px;
    color: var(--dark);
}
