/**
 * Customer Portal Stylesheet
 */

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === Header === */
.site-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 60px;
    gap: 30px;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    font-size: 18px;
}

.logo img {
    height: 36px;
}

.main-nav {
    display: flex;
    gap: 5px;
    flex: 1;
}

.main-nav a {
    padding: 8px 16px;
    text-decoration: none;
    color: rgba(255,255,255,0.85);
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.main-nav a:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.main-nav a.active {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

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

.company-name {
    font-weight: 600;
    color: #fff;
}

.user-email {
    color: rgba(255,255,255,0.75);
}

.logout-btn {
    padding: 6px 12px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid rgba(255,255,255,0.3);
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
    color: #fff;
}

/* === Main Content === */
.main-content {
    flex: 1;
    padding: 30px 0;
}

/* === Page Title === */
.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.page-header .subtitle {
    color: #666;
    font-size: 14px;
}

/* === Cards === */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* === Tables === */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table th {
    font-weight: 600;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #0066cc;
    color: #fff;
}

.btn-primary:hover {
    background: #0052a3;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

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

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

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

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-inline {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.form-inline .form-group {
    margin-bottom: 0;
    flex: 1;
}

/* === Radio/Checkbox === */
.radio-group,
.checkbox-group {
    display: flex;
    gap: 20px;
}

.radio-group label,
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
}

/* === Status Badges === */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-secondary {
    background: #e9ecef;
    color: #6c757d;
}

/* === Store Tag === */
.store-tag {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    background: #e9ecef;
    color: #495057;
    border-radius: 3px;
    margin-left: 8px;
}

/* === Email List === */
.email-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.email-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.email-item:last-child {
    border-bottom: none;
}

.email-item .email-address {
    flex: 1;
    font-weight: 500;
}

.email-item .email-type {
    margin-right: 10px;
}

.email-item .email-label {
    color: #666;
    font-size: 13px;
    margin-left: 10px;
}

.email-item .email-actions {
    display: flex;
    gap: 5px;
}

/* === Dashboard Stats === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.stat-card .stat-label {
    color: #666;
    font-size: 13px;
}

/* === Order List === */
.order-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
    gap: 20px;
}

.order-item:hover {
    background: #f9f9f9;
}

.order-item .order-number {
    font-weight: 600;
    min-width: 100px;
}

.order-item .order-date {
    color: #666;
    min-width: 120px;
}

.order-item .order-status {
    min-width: 120px;
}

.order-item .order-total {
    font-weight: 600;
    min-width: 100px;
    text-align: right;
}

.order-item .order-actions {
    margin-left: auto;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* === Messages === */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* === Loading === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #eee;
    border-top-color: #0066cc;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* === Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* === Footer === */
.site-footer {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 20px 0;
    margin-top: auto;
}

.site-footer p {
    margin: 5px 0;
    color: #666;
    font-size: 13px;
}

.site-footer a {
    color: #0066cc;
    text-decoration: none;
}

/* === Responsive === */
@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 15px;
    }
    
    .main-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
    
    .user-info {
        flex-wrap: wrap;
        font-size: 12px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .order-item {
        flex-wrap: wrap;
    }
    
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
}

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

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 {
    margin: 0 0 10px 0;
    font-size: 24px;
}

.login-box .subtitle {
    color: #666;
    margin-bottom: 30px;
}

.login-box .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

.store-select {
    margin-bottom: 20px;
}

.store-select select {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
