/* CRM Stylesheet - PHP 7.2 Compatible */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    background: #f5f5f5;
}

a {
    color: #2196F3;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
#wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
#top {
    background: #1a1a2e;
    color: #fff;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo img {
    height: 40px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.username {
    color: #ccc;
}

.logout-btn {
    color: #ff6b6b;
    padding: 5px 10px;
    border: 1px solid #ff6b6b;
    border-radius: 3px;
}

.logout-btn:hover {
    background: #ff6b6b;
    color: #fff;
    text-decoration: none;
}

/* Main Menu */
#main-menu {
    background: #16213e;
    padding: 0 20px;
}

.dropdown {
    list-style: none;
    display: flex;
    gap: 5px;
}

.dropdown > li {
    position: relative;
}

.dropdown > li > a {
    display: block;
    padding: 12px 15px;
    color: #ccc;
    font-weight: 500;
}

.dropdown > li > a:hover,
.dropdown > li.active > a {
    background: #0f3460;
    color: #fff;
    text-decoration: none;
}

.sub_menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #1a1a2e;
    min-width: 200px;
    list-style: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 100;
}

.dropdown > li:hover .sub_menu {
    display: block;
}

.sub_menu li a {
    display: block;
    padding: 10px 15px;
    color: #ccc;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sub_menu li a:hover {
    background: #0f3460;
    color: #fff;
    text-decoration: none;
}

/* Content */
#content {
    flex: 1;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
}

.btn:hover {
    background: #d0d0d0;
    text-decoration: none;
}

.btn-primary {
    background: #2196F3;
    color: #fff;
}

.btn-primary:hover {
    background: #1976D2;
}

.btn-secondary {
    background: #757575;
    color: #fff;
}

.btn-danger {
    background: #f44336;
    color: #fff;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.data-table tbody tr:hover {
    background: #f5f9ff;
}

.data-table .row-inactive {
    opacity: 0.5;
}

.data-table .row-low-stock {
    background: #fff3e0;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 3px rgba(33,150,243,0.3);
}

/* Filters */
.filters-form {
    background: #fff;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group.checkbox {
    display: flex;
    align-items: center;
}

.filter-group.checkbox label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
}

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

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* Stats */
.stats-row,
.stats-grid {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-card,
.stat-item {
    background: #fff;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
    min-width: 120px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #777;
    margin-top: 5px;
}

.stat-warning {
    border-left: 3px solid #ff9800;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 3px;
    font-weight: 500;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-warning {
    background: #fff3e0;
    color: #e65100;
}

.badge-danger {
    background: #ffebee;
    color: #c62828;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 3px;
    font-weight: 500;
}

.status-new { background: #e3f2fd; color: #1565c0; }
.status-unpaid { background: #ffebee; color: #c62828; }
.status-production { background: #fff3e0; color: #e65100; }
.status-sewing { background: #f3e5f5; color: #7b1fa2; }
.status-preparing { background: #e0f2f1; color: #00695c; }
.status-ready { background: #e8f5e9; color: #2e7d32; }
.status-done { background: #c8e6c9; color: #1b5e20; }
.status-cancelled { background: #eceff1; color: #546e7a; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
}

.page-info {
    color: #777;
}

/* Detail tables */
.detail-section {
    background: #fff;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.detail-section h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.detail-table {
    width: 100%;
}

.detail-table th {
    width: 150px;
    text-align: left;
    padding: 8px 0;
    color: #777;
    font-weight: 500;
}

.detail-table td {
    padding: 8px 0;
}

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

.page-header h1 {
    font-size: 24px;
    color: #333;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Auth page */
.auth-page {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#auth-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-container {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.auth-header {
    background: #0f3460;
    color: #fff;
    padding: 30px;
    text-align: center;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 500;
}

.auth-content {
    padding: 30px;
}

.login-box h2 {
    margin-bottom: 20px;
    color: #333;
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.login-box button {
    width: 100%;
    padding: 12px;
    font-size: 14px;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 15px;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

/* Footer */
#footer {
    background: #1a1a2e;
    color: #777;
    padding: 15px 20px;
    text-align: center;
    font-size: 12px;
}

/* Warehouse specific */
.warehouses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.warehouse-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.warehouse-card h3 {
    color: #333;
    margin-bottom: 5px;
}

.warehouse-symbol {
    color: #777;
    font-size: 12px;
    margin-bottom: 15px;
}

.warehouse-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.warehouse-selector {
    margin-bottom: 20px;
}

.warehouse-selector select {
    padding: 8px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.code-part {
    color: #777;
    margin-left: 3px;
}

.qty-cell {
    font-weight: 600;
}

.qty-unit {
    color: #777;
    font-weight: 400;
    font-size: 11px;
}

.actions-cell {
    white-space: nowrap;
}

.product-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.product-details .full-width {
    grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 768px) {
    .dropdown {
        flex-direction: column;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        gap: 10px;
    }

    .product-details {
        grid-template-columns: 1fr;
    }
}
