/* DRD Stock Admin Dashboard - Orange Theme */

:root {
    --primary: #FF8C00;
    --primary-light: #FFA500;
    --primary-dark: #FF7400;
    --secondary: #00A651;
    --danger: #EF4444;
    --warning: #F59E0B;
    --dark: #333333;
    --light: #F8F9FA;
    --white: #FFFFFF;
    --border: #E5E7EB;
    --gray: #9CA3AF;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #F3F4F6;
    color: var(--dark);
    min-height: 100vh;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-screen p {
    margin-top: 20px;
    font-size: 16px;
}

/* Dashboard */
.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard.hidden {
    display: none;
}

/* Header */
.header {
    background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
}

.refresh-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(255, 140, 0, 0.25);
    border-radius: 6px;
    border: 1px solid rgba(255, 140, 0, 0.3);
}

.refresh-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: none;
}

.refresh-icon svg {
    stroke: #FFA500;
    display: block;
}

.refresh-icon.spinning {
    animation: spin 1s linear infinite;
}

.refresh-icon.spinning svg {
    stroke: #FFD700;
}

.refresh-text {
    font-size: 12px;
    color: white;
    font-weight: 500;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all 0.2s;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Orange refresh button */
.btn-refresh {
    background: var(--primary);
    color: white;
}

.btn-refresh:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}

.btn-refresh svg {
    stroke: white;
}

/* Orange style for manual refresh button */
#manualRefreshBtn {
    background: rgba(255, 140, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.4);
}

#manualRefreshBtn:hover {
    background: rgba(255, 140, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.05);
}

#manualRefreshBtn:active {
    transform: scale(0.95);
}

#manualRefreshBtn .refresh-spinning {
    animation: spin 1s linear infinite;
}

/* Stats Container */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    font-size: 48px;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.stat-card.orange .stat-icon {
    background: rgba(255, 140, 0, 0.1);
}

.stat-card.green .stat-icon {
    background: rgba(0, 166, 81, 0.1);
}

.stat-card.red .stat-icon {
    background: rgba(239, 68, 68, 0.1);
}

.stat-card.yellow .stat-icon {
    background: rgba(245, 158, 11, 0.1);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 14px;
    color: var(--gray);
    font-weight: 500;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    padding: 0 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

.tab-content.active {
    display: block;
}

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

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

.actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn-secondary {
    padding: 12px 20px;
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-danger {
    padding: 12px 24px;
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transition: all 0.2s;
}

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

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.select-input {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: white;
    transition: border-color 0.2s;
}

.select-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 12px 20px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--gray);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

/* Search */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Table */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

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

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

.data-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--dark);
}

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

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

.data-table .loading {
    text-align: center;
    color: var(--gray);
    padding: 40px;
    font-style: italic;
}

.data-table .empty {
    text-align: center;
    color: var(--gray);
    padding: 40px;
}

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

.badge.in-stock {
    background: #D1FAE5;
    color: var(--secondary);
}

.badge.out-of-stock {
    background: #FEE2E2;
    color: var(--danger);
}

.badge.low-stock {
    background: #FEF3C7;
    color: var(--warning);
}

.badge.in {
    background: #DBEAFE;
    color: #2563EB;
}

.badge.out {
    background: #FCE7F3;
    color: #DB2777;
}

/* Activity Container */
.activity-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.activity-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.activity-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.activity-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    font-weight: 700;
}

/* ========== USER MANAGEMENT MODALS ========== */

.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.7) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
    padding: 20px;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 24px 30px;
    border-bottom: 2px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--gray);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #F3F4F6;
    color: var(--dark);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid #E5E7EB;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Import Summary */
.import-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.summary-item {
    background: #F9FAFB;
    padding: 16px 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid #E5E7EB;
}

.summary-label {
    font-size: 14px;
    color: var(--gray);
    font-weight: 500;
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

.summary-value.green {
    color: var(--secondary);
}

.summary-value.orange {
    color: var(--primary);
}

.summary-value.red {
    color: var(--danger);
}

/* Preview Table */
.preview-table-container {
    max-height: 400px;
    overflow-y: auto;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    margin-bottom: 20px;
}

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

.preview-table thead {
    background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.preview-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.preview-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #E5E7EB;
    font-size: 14px;
}

.preview-table tbody tr:hover {
    background: #F9FAFB;
}

.preview-table .badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.preview-table .badge.update {
    background: #D1FAE5;
    color: #065F46;
}

.preview-table .badge.create {
    background: #FED7AA;
    color: #9A3412;
}

.preview-table .badge.error {
    background: #FEE2E2;
    color: #991B1B;
}

/* Error List */
.error-list {
    background: #FEF2F2;
    border: 2px solid #FCA5A5;
    border-radius: 8px;
    padding: 16px 20px;
    margin-top: 20px;
}

.error-list.hidden {
    display: none;
}

.error-list h3 {
    color: var(--danger);
    margin: 0 0 12px 0;
    font-size: 16px;
}

.error-item {
    padding: 8px 0;
    color: #991B1B;
    font-size: 14px;
    display: flex;
    gap: 8px;
}

.error-item::before {
    content: "⚠";
    flex-shrink: 0;
}

/* Results Summary */
.results-summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid;
}

.result-item.success {
    background: #D1FAE5;
    border-color: #10B981;
}

.result-item.error {
    background: #FEE2E2;
    border-color: #EF4444;
}

.result-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.result-item.success .result-icon {
    background: #10B981;
    color: white;
}

.result-item.error .result-icon {
    background: #EF4444;
    color: white;
}

.result-text {
    font-size: 16px;
    color: var(--dark);
}

.result-text strong {
    font-size: 24px;
    color: var(--dark);
}

/* Button Spacing in Actions */
.actions {
    display: flex;
    gap: 12px;
}

/* Admin Only Elements */
.admin-only {
    /* Will be shown/hidden via JavaScript based on user role */
}

/* Hide loading screen when hidden class is added */
.loading-screen.hidden {
    display: none !important;
}

/* Hide page loading when hidden class is added */
.page-loading.hidden {
    display: none !important;
}
