/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f7;
}

/* Portal Landing Page */
.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.portal-header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

.portal-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.portal-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.dashboard-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 800px;
    width: 100%;
}

.dashboard-card {
    background: white;
    padding: 2.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.dashboard-card h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.dashboard-card p {
    color: #666;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-customer {
    background: #007AFF;
    color: white;
}

.btn-customer:hover {
    background: #0056CC;
}

.btn-admin {
    background: #FF3B30;
    color: white;
}

.btn-admin:hover {
    background: #D70015;
}

/* Dashboard Layout */
.dashboard {
    display: grid;
    grid-template-areas: 
        "header header"
        "sidebar main";
    grid-template-columns: 250px 1fr;
    grid-template-rows: 70px 1fr;
    min-height: 100vh;
}

/* Header */
.dashboard-header {
    grid-area: header;
    background: white;
    padding: 0 2rem;
    border-bottom: 1px solid #e5e5e7;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-header {
    background: #1a1a1a;
    color: white;
    border-bottom-color: #333;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #007AFF;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.admin-avatar {
    background: #FF3B30;
}

.logout-btn {
    color: #FF3B30;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.logout-btn:hover {
    background: rgba(255, 59, 48, 0.1);
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: white;
    border-right: 1px solid #e5e5e7;
    padding: 1rem 0;
}

.admin-sidebar {
    background: #2a2a2a;
    border-right-color: #404040;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: block;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: #666;
    transition: all 0.2s ease;
    border-right: 3px solid transparent;
}

.admin-sidebar .nav-link {
    color: #ccc;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
    border-right-color: #007AFF;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
    border-right-color: #FF3B30;
}

/* Main Content */
.main-content {
    grid-area: main;
    padding: 2rem;
    overflow-y: auto;
    background: #f5f5f7;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a1a;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 122, 255, 0.1);
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-info p {
    color: #666;
    font-size: 0.9rem;
}

.stat-change {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.stat-change.positive {
    color: #34C759;
}

.stat-change.negative {
    color: #FF3B30;
}

/* Admin specific stat cards */
.admin-stats .revenue .stat-icon {
    background: rgba(52, 199, 89, 0.1);
}

.admin-stats .orders .stat-icon {
    background: rgba(0, 122, 255, 0.1);
}

.admin-stats .users .stat-icon {
    background: rgba(255, 149, 0, 0.1);
}

.admin-stats .conversion .stat-icon {
    background: rgba(175, 82, 222, 0.1);
}

/* Orders */
.recent-orders,
.orders-list {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.recent-orders h2 {
    margin-bottom: 1rem;
    color: #1a1a1a;
}

.orders-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.order-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    align-items: center;
}

.order-card {
    border: 1px solid #e5e5e7;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: white;
}

.order-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 1rem;
}

.order-header h3 {
    color: #007AFF;
}

.status-badge,
.order-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-delivered {
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
}

.status-transit,
.status-processing {
    background: rgba(255, 149, 0, 0.1);
    color: #FF9500;
}

.status-active {
    background: rgba(52, 199, 89, 0.1);
    color: #34C759;
}

.order-details {
    margin-bottom: 1rem;
    color: #666;
}

.view-details-btn,
.edit-profile-btn,
.chat-btn,
.add-user-btn,
.add-product-btn,
.save-btn {
    background: #007AFF;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.view-details-btn:hover,
.edit-profile-btn:hover,
.chat-btn:hover,
.add-user-btn:hover,
.add-product-btn:hover,
.save-btn:hover {
    background: #0056CC;
}

/* Profile Form */
.profile-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 500px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e5e7;
    border-radius: 6px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* Support */
.support-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.support-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.support-card h3 {
    margin-bottom: 1rem;
    color: #1a1a1a;
}

.support-card p {
    color: #666;
    margin-bottom: 0.5rem;
}

/* Admin Tables */
.users-table,
.orders-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.table-header,
.table-row {
    display: grid;
    grid-template-columns: 0.6fr 0.6fr 0.5fr 0.7fr 1fr 0.6fr 1.5fr 1.2fr 1fr 1fr 0.8fr 0.6fr 0.8fr 0.6fr 1fr;
    gap: 0.5rem;
    padding: 0.75rem;
    align-items: center;
    font-size: 0.85rem;
}

.table-header {
    background: #f5f5f7;
    font-weight: 600;
    border-bottom: 1px solid #e5e5e7;
}

.table-row {
    border-bottom: 1px solid #f0f0f0;
}

.table-row:last-child {
    border-bottom: none;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

/* Map Links */
.map-link {
    color: #007AFF;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.map-link:hover {
    background-color: #007AFF;
    color: white;
    text-decoration: none;
}

.edit-btn,
.view-btn {
    background: #007AFF;
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.delete-btn {
    background: #FF3B30;
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.product-image {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.product-card h3 {
    margin-bottom: 0.5rem;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #007AFF;
    margin-bottom: 0.5rem;
}

.product-stock {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Charts and Analytics */
.dashboard-charts {
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chart-container h3 {
    margin-bottom: 1rem;
    color: #1a1a1a;
}

.chart-placeholder {
    height: 200px;
    background: #f5f5f7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 1.1rem;
}

.chart-placeholder.large {
    height: 300px;
}

.analytics-charts .full-width {
    grid-column: 1 / -1;
    margin-bottom: 1.5rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.settings-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.settings-card h3 {
    margin-bottom: 1.5rem;
    color: #1a1a1a;
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.setting-item input[type="text"],
.setting-item input[type="email"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e5e7;
    border-radius: 6px;
    font-size: 1rem;
}

.setting-item input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard {
        grid-template-areas: 
            "header"
            "main";
        grid-template-columns: 1fr;
        grid-template-rows: 70px 1fr;
    }
    
    .sidebar {
        display: none;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .table-header {
        display: none;
    }
    
    .table-row {
        display: block;
        padding: 1rem;
        border: 1px solid #e5e5e7;
        border-radius: 8px;
        margin-bottom: 0.5rem;
    }
    
    .order-item {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* Pagination Styles */
.pagination {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    color: #666;
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.page-btn {
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    color: #333;
    background: white;
    transition: all 0.3s ease;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
}

.page-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

.page-btn.current {
    background: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
}

.page-btn.first,
.page-btn.last {
    font-weight: bold;
}

.page-btn.prev,
.page-btn.next {
    padding: 8px 15px;
}

@media (max-width: 768px) {
    .pagination {
        flex-direction: column;
        text-align: center;
    }
    
    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 30px;
    }
}