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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

/* Navbar */
.navbar {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-container h1 {
    font-size: 1.5rem;
    color: #667eea;
}

.nav-menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-menu a {
    color: #333;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.3s;
}

.nav-menu a:hover {
    background: #f0f0f0;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-card h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
    font-size: 0.9rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

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

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

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

/* Ensure branch select is always enabled */
.branch-select-enabled {
    pointer-events: auto !important;
    background-color: white !important;
    cursor: pointer !important;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.required {
    color: #e74c3c;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-success {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
    min-height: 44px; /* iOS recommended touch target size */
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation; /* Prevent double-tap zoom on mobile */
}

.btn-success:hover {
    background: #229954;
}

.btn-success:active {
    background: #1e8449;
    transform: scale(0.98);
}

.btn-success:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Demo Accounts */
.demo-accounts {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.demo-accounts h3 {
    font-size: 1rem;
    color: #555;
    margin-bottom: 15px;
}

.demo-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.demo-item {
    padding: 10px;
    background: white;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #666;
}

.demo-admin {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.demo-section-title {
    padding: 10px;
    background: #e8f4f8;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #667eea;
    margin-top: 5px;
}

/* Wizard */
.wizard-container {
    background: white;
    border-radius: 12px;
    padding: 40px;
    margin-top: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.progress-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.progress-bar::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #ddd;
    z-index: 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ddd;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 8px;
}

.progress-step.active .step-number {
    background: #667eea;
    color: white;
}

.progress-step.completed .step-number {
    background: #27ae60;
    color: white;
}

.step-label {
    font-size: 0.85rem;
    color: #888;
    text-align: center;
}

.progress-step.active .step-label {
    color: #667eea;
    font-weight: 600;
}

.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
}

.wizard-step h3 {
    margin-bottom: 25px;
    color: #667eea;
    font-size: 1.5rem;
}

.wizard-step h4 {
    margin: 20px 0 15px 0;
    color: #555;
    font-size: 1.1rem;
}

.wizard-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.wizard-buttons button {
    min-height: 44px; /* iOS recommended touch target size */
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation; /* Prevent double-tap zoom */
    flex: 1;
    min-width: 100px;
}

/* Table */
.filter-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow-x: auto;
}

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

thead {
    background: #667eea;
    color: white;
}

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

tbody tr:hover {
    background: #f8f9fa;
}

.btn-view {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-right: 5px;
}

.btn-view:hover {
    background: #5568d3;
}

.btn-edit {
    padding: 6px 12px;
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-right: 5px;
}

.btn-edit:hover {
    background: #e67e22;
}

.btn-delete {
    padding: 6px 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-delete:hover {
    background: #c0392b;
}

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

.pagination button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.detail-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.detail-section h3 {
    margin-bottom: 10px;
    color: #667eea;
}

.detail-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.detail-label {
    font-weight: 600;
    color: #555;
}

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

.kpi-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.kpi-title {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 10px;
}

.kpi-value {
    font-size: 3rem;
    font-weight: 700;
    color: #667eea;
}

.kpi-unit {
    font-size: 1rem;
    color: #888;
    margin-top: 5px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-card h3 {
    margin-bottom: 20px;
    color: #667eea;
}

/* Insights */
.insights-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.insights-section h3 {
    margin-bottom: 20px;
    color: #667eea;
}

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

.insight-card {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.insight-card h4 {
    margin-bottom: 15px;
    color: #555;
}

.insight-card ul {
    list-style-position: inside;
}

.insight-card li {
    margin-bottom: 8px;
    color: #666;
}

/* Summary Section */
.summary-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.summary-section h3 {
    margin-bottom: 20px;
    color: #667eea;
}

.summary-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.summary-controls label {
    font-weight: 600;
    color: #555;
}

.summary-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
}

.summary-info {
    margin-left: auto;
    color: #888;
    font-size: 0.9rem;
}

.summary-table-container {
    overflow-x: auto;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.summary-table thead {
    background: #667eea;
    color: white;
}

.summary-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.summary-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.summary-table tbody tr:hover {
    background: #f8f9fa;
}

.summary-table tbody tr.highlight {
    background: #e8f4f8;
}

.trend-up {
    color: #27ae60;
    font-weight: 600;
}

.trend-up::before {
    content: '↑ ';
}

.trend-down {
    color: #e74c3c;
    font-weight: 600;
}

.trend-down::before {
    content: '↓ ';
}

.trend-stable {
    color: #95a5a6;
}

.trend-stable::before {
    content: '→ ';
}

/* Trend Section */
.trend-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.trend-section h3 {
    margin-bottom: 20px;
    color: #667eea;
}

.trend-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
}

.trend-section .chart-card h4 {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 15px;
}

/* Branch Detail Page */
.branch-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.branch-detail-header h2 {
    color: #667eea;
    margin: 0;
}

.branch-detail-header .btn-secondary {
    text-decoration: none;
    display: inline-block;
}

.report-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.report-card h4 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 1.2rem;
}

.report-section {
    margin-bottom: 15px;
}

.report-section strong {
    display: block;
    color: #555;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.report-section p {
    color: #666;
    line-height: 1.6;
    margin: 0;
    padding-left: 10px;
}

/* Branch Link Style */
.branch-link {
    color: #667eea;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.branch-link:hover {
    color: #5568d3;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .progress-bar {
        flex-wrap: wrap;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .wizard-buttons {
        flex-direction: column;
    }
}