/**
 * Zo-Way SACCO - Main Stylesheet
 * Thirdsan Enterprises Ltd
 * Color Scheme: Trust & Growth (Teal/Orange)
 */

/* ========================================
   ROOT VARIABLES
   ======================================== */
:root {
    --primary: #0A7373;
    --primary-dark: #085858;
    --primary-light: #0D9494;
    --secondary: #2D9596;
    --secondary-light: #4AACAD;
    --accent: #F4A261;
    --accent-dark: #E08E47;
    --background: #F8F9FA;
    --white: #FFFFFF;
    --light: #ECF0F1;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --success: #27AE60;
    --danger: #E74C3C;
    --warning: #F39C12;
    --info: #3498DB;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 15px;
    --radius-xl: 20px;
    
    --transition: all 0.3s ease;
}

/* ========================================
   RESET & BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

/* ========================================
   CONTAINER & LAYOUT
   ======================================== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    width: 100%;
    padding: 0 20px;
}

.section {
    padding: 60px 0;
}

.section-sm {
    padding: 40px 0;
}

.section-lg {
    padding: 80px 0;
}

/* ========================================
   NAVBAR
   ======================================== */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    height: 50px;
    width: auto;
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

.navbar-menu li {
    margin: 0;
}

.navbar-menu a {
    color: var(--text);
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.navbar-menu a:not(.btn):hover,
.navbar-menu a:not(.btn).active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Navbar buttons - improved styling */
.navbar-menu .btn {
    padding: 0.6rem 1.5rem;
    margin-left: 0.5rem;
    border-bottom: none;
}

.navbar-menu .btn-outline {
    border-width: 2px;
}

.navbar-menu .btn-outline:hover {
    transform: translateY(-1px);
}

.navbar-menu .btn-primary:hover {
    transform: translateY(-1px);
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    cursor: pointer;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

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

.btn-accent {
    background: var(--accent);
    color: var(--white);
}

.btn-accent:hover {
    background: var(--accent-dark);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.btn-lg {
    padding: 15px 40px;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 8px 20px;
    font-size: 0.9rem;
}

.btn-block {
    display: block;
    width: 100%;
}

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

/* ========================================
   CARDS
   ======================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--light);
    background: var(--white);
}

.card-body {
    padding: 1.5rem;
    flex: 1;
}

.card-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--light);
    background: var(--background);
    margin-top: auto;
}

/* ========================================
   FORMS
   ======================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid var(--light);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 115, 115, 0.1);
}

.form-control::placeholder {
    color: var(--text-light);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232C3E50' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.form-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.form-help {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* ========================================
   ALERTS
   ======================================== */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left-color: var(--success);
}

.alert-error,
.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left-color: var(--danger);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: var(--warning);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: var(--info);
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: 100px 0;
    text-align: center;
}

.hero h1 {
    color: var(--white);
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========================================
   GRID SYSTEM
   ======================================== */
.row {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

.col {
    min-width: 0; /* Prevents grid blowout */
}

/* 2-column grid */
.row:has(.col-2) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr));
}

/* 3-column grid */
.row:has(.col-3) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

/* 4-column grid - FIXED for responsive */
.row:has(.col-4) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}

.col-2, .col-3, .col-4 {
    width: 100%;
}

/* ========================================
   TABLES
   ======================================== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead {
    background: var(--primary);
    color: var(--white);
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
}

.table tbody tr {
    border-bottom: 1px solid var(--light);
}

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

/* ========================================
   BADGES
   ======================================== */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    border-radius: var(--radius-sm);
}

.badge-success {
    background: var(--success);
    color: var(--white);
}

.badge-danger {
    background: var(--danger);
    color: var(--white);
}

.badge-warning {
    background: var(--warning);
    color: var(--white);
}

.badge-info {
    background: var(--info);
    color: var(--white);
}

.badge-primary {
    background: var(--primary);
    color: var(--white);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    background: var(--text);
    color: var(--white);
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-section h3 {
    color: var(--white);
    margin-bottom: 1rem;
}

.footer-section a {
    color: var(--light);
    display: block;
    margin-bottom: 0.5rem;
}

.footer-section a:hover {
    color: var(--accent);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    text-align: center;
    color: var(--light);
}

/* ========================================
   UTILITIES
   ======================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-light); }

.bg-primary { background: var(--primary); }
.bg-success { background: var(--success); }
.bg-danger { background: var(--danger); }
.bg-light { background: var(--light); }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    
    .hero { padding: 60px 0; }
    .hero h1 { font-size: 2rem; }
    
    .navbar-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        gap: 0.5rem;
    }
    
    .navbar-menu.active {
        display: flex;
    }
    
    .navbar-menu li {
        width: 100%;
    }
    
    .navbar-menu a {
        display: block;
        padding: 0.75rem 1rem;
        width: 100%;
    }
    
    .navbar-menu .btn {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }
    
    .navbar-toggle {
        display: block;
    }
    
    /* Grid system - mobile adjustments */
    .row {
        gap: 1.5rem;
    }
    
    .row:has(.col-2),
    .row:has(.col-3),
    .row:has(.col-4) {
        grid-template-columns: 1fr;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .section {
        padding: 40px 0;
    }
}
