/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 500;
}

nav a:hover {
    background-color: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

/* Page Layout */
main {
    flex: 1;
    padding: 20px 0;
}

.page {
    display: none;
    animation: fadeIn 0.5s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Home Page */
.center-text {
    text-align: center;
    margin-bottom: 30px;
}

.search-box {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin: 30px auto;
    max-width: 900px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.search-box select,
.search-box input {
    padding: 12px 15px;
    border: 2px solid #e0e6ed;
    border-radius: 6px;
    font-size: 16px;
    min-width: 200px;
    transition: all 0.3s ease;
    background: white;
}

.search-box select:focus,
.search-box input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

#searchBtn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
}

#searchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* Stations Grid */
.stations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.station-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #e0e6ed;
}

.station-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.station-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.3rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.station-location {
    color: #666;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.station-contact {
    color: #666;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.products-list {
    margin-top: 15px;
}

.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.product-item.out-of-stock {
    border-left-color: #e74c3c;
    opacity: 0.8;
}

.product-name {
    font-weight: 600;
    color: #2c3e50;
}

.product-price {
    color: #27ae60;
    font-weight: bold;
    font-size: 1.1rem;
}

.product-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.product-status.available {
    background-color: #d4edda;
    color: #155724;
}

.product-status.out-of-stock {
    background-color: #f8d7da;
    color: #721c24;
}

/* Insights Page */
.chart-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin: 30px auto;
    max-width: 900px;
}

#salesChart, #adminChart {
    width: 100% !important;
    height: 400px !important;
}

.export-container {
    text-align: center;
    margin-top: 30px;
}

#exportExcel {
    padding: 12px 30px;
    background: linear-gradient(135deg, #27ae60 0%, #219653 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
}

#exportExcel:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

/* Auth Forms */
.auth-form {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    max-width: 500px;
    margin: 40px auto;
}

.auth-form h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
}

.auth-form input,
.auth-form select {
    width: 100%;
    padding: 14px;
    margin-bottom: 20px;
    border: 2px solid #e0e6ed;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.auth-form input:focus,
.auth-form select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.auth-form button {
    width: 100%;
    padding: 14px;
    margin: 10px 0;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-form button:first-of-type {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.auth-form button:last-of-type {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e0e6ed;
}

.auth-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Manager Dashboard */
.dashboard {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    max-width: 800px;
    margin: 0 auto;
}

.product-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.product-form select,
.product-form input {
    padding: 12px;
    border: 2px solid #e0e6ed;
    border-radius: 6px;
    font-size: 16px;
}

.product-form button {
    grid-column: 1 / -1;
    padding: 14px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
}

.product-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.dashboard-actions {
    text-align: center;
    margin-top: 20px;
}

.logout-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Admin Dashboard */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.admin-header h2 {
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Admin Analytics Styles */
.analytics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.analytics-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid #e0e6ed;
}

.analytics-card h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.2rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.metric {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.metric-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.metric-value {
    display: block;
    font-size: 1.3rem;
    font-weight: bold;
    color: #2c3e50;
}

.product-analytics,
.state-analytics {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-metric,
.state-metric {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #2ecc71;
}

.product-name,
.state-name {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.metric-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    font-size: 0.9rem;
}

.metric-details span {
    background: white;
    padding: 5px 10px;
    border-radius: 4px;
    display: inline-block;
}

/* Admin Station Cards */
.admin-station-card {
    position: relative;
}

.station-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.station-state {
    background: #3498db;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.station-analytics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
}

.station-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e6ed;
}

.station-products {
    margin: 20px 0;
}

.station-products h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1rem;
}

.delete-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.delete-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Export Options */
.export-options {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-top: 40px;
}

.export-options h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.export-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.export-btn {
    padding: 15px 25px;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 200px;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}

/* Messages */
.message {
    text-align: center;
    padding: 10px;
    margin: 15px 0;
    border-radius: 6px;
    font-weight: 500;
}

/* No Results/Data */
.no-results, .no-data {
    text-align: center;
    padding: 40px;
    color: #666;
    background: #f8f9fa;
    border-radius: 10px;
    grid-column: 1 / -1;
}

.no-products {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 10px;
}

/* Status indicators */
.status {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status.available {
    background-color: #d4edda;
    color: #155724;
}

.status.out-of-stock {
    background-color: #f8d7da;
    color: #721c24;
}

/* Footer */
footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .search-box {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
    }
    
    .search-box select,
    .search-box input {
        min-width: auto;
        width: 100%;
    }
    
    .stations-grid {
        grid-template-columns: 1fr;
    }
    
    .auth-form {
        margin: 20px;
        padding: 30px;
    }
    
    .chart-container {
        padding: 20px;
        margin: 20px;
    }
    
    #salesChart, #adminChart {
        height: 300px !important;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .station-analytics {
        grid-template-columns: 1fr;
    }
    
    .metric-details {
        grid-template-columns: 1fr;
    }
    
    .admin-header {
        flex-direction: column;
        text-align: center;
    }
    
    .export-buttons {
        flex-direction: column;
    }
    
    .export-btn {
        width: 100%;
    }
}