/**
 * MAH Premium Styling
 * Adapted from MyAlmightyHome-AI-Website
 * Color scheme: Dark green + Bronze accents
 */

/* =====================
   ROOT VARIABLES
   ===================== */
:root {
    /* Green Theme */
    --deep-green: #006400;
    --emerald: #50C878;
    --forest-green: #228B22;
    --muted-green: #27ae60;
    --dark-green: #013220;
    --bright-green: #32CD32;

    /* Bronze/Brown Accents */
    --bronze: #CD7F32;
    --bronze-light: #E89B4F;
    --brown: #8B4513;

    /* Backgrounds */
    --dark-bg: #000a00;
    --darker-bg: #000500;
    --card-bg: rgba(0, 10, 0, 0.6);
    --card-hover-bg: rgba(0, 20, 0, 0.7);

    /* Text Colors */
    --text-primary: rgba(245, 247, 245, 0.95);
    --text-secondary: rgba(184, 200, 176, 0.85);
    --text-muted: rgba(143, 160, 127, 0.7);

    /* Special Effects */
    --warm-bronze: rgba(205, 127, 50, 0.15);
    --glow-green: rgba(80, 200, 120, 0.3);
    --glow-bronze: rgba(205, 127, 50, 0.3);

    /* Status Colors */
    --status-active: #50C878;
    --status-pending: #FFD700;
    --status-cancelled: #DC143C;
    --status-hold: #FF8C00;
}

/* =====================
   GLOBAL RESETS
   ===================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--darker-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* =====================
   TYPOGRAPHY
   ===================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 800;
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
}

p {
    color: var(--text-secondary);
}

/* =====================
   SCROLLBAR
   ===================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--darker-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--deep-green);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--emerald);
}

/* =====================
   GLASSMORPHIC CARDS
   ===================== */
.glass-card {
    background: var(--card-bg);
    border: 1px solid rgba(80, 200, 120, 0.2);
    border-radius: 16px;
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(80, 200, 120, 0.1);
    padding: 2rem;
    transition: all 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-4px);
    border-color: rgba(80, 200, 120, 0.4);
    box-shadow:
        0 12px 48px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(80, 200, 120, 0.2);
}

.glass-card-flat {
    background: var(--card-bg);
    border: 1px solid rgba(80, 200, 120, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(15px);
    padding: 1.5rem;
}

/* =====================
   BUTTONS
   ===================== */
.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.9) 0%, rgba(139, 69, 19, 0.9) 100%);
    color: white;
    box-shadow: 0 8px 24px var(--glow-bronze);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(205, 127, 50, 0.4);
}

.btn-secondary {
    background: rgba(80, 200, 120, 0.15);
    color: var(--text-primary);
    border: 2px solid rgba(80, 200, 120, 0.4);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(80, 200, 120, 0.25);
    border-color: var(--emerald);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--emerald) 0%, var(--forest-green) 100%);
    color: white;
    box-shadow: 0 8px 24px var(--glow-green);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px var(--glow-green);
}

.btn-danger {
    background: linear-gradient(135deg, #DC143C 0%, #8B0000 100%);
    color: white;
    box-shadow: 0 8px 24px rgba(220, 20, 60, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(220, 20, 60, 0.4);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* =====================
   NAVIGATION
   ===================== */
.mah-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.5rem 3rem;
}

.nav-container {
    width: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, rgba(0, 10, 0, 0.9) 0%, rgba(0, 20, 0, 0.85) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 9999px;
    border: 1px solid rgba(80, 200, 120, 0.3);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(80, 200, 120, 0.15),
        inset 0 1px 0 rgba(205, 127, 50, 0.1);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, var(--deep-green) 0%, var(--bronze) 50%, var(--emerald) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 10px rgba(80, 200, 120, 0.4));
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
}

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

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 20, 0, 0.5);
    border: 1px solid rgba(80, 200, 120, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(80, 200, 120, 0.1);
    background: rgba(0, 30, 0, 0.6);
}

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

select.form-control {
    cursor: pointer;
}

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

/* =====================
   TABLES
   ===================== */
.table-container {
    background: var(--card-bg);
    border: 1px solid rgba(80, 200, 120, 0.2);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    padding: 1.5rem;
    overflow-x: auto;
}

.mah-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.mah-table thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 2px solid rgba(80, 200, 120, 0.3);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mah-table tbody tr {
    background: rgba(0, 10, 0, 0.4);
    transition: all 0.2s ease;
}

.mah-table tbody tr:hover {
    background: rgba(0, 20, 0, 0.6);
    transform: scale(1.01);
}

.mah-table tbody td {
    padding: 1rem;
    color: var(--text-secondary);
    border-top: 1px solid rgba(80, 200, 120, 0.1);
    border-bottom: 1px solid rgba(80, 200, 120, 0.1);
}

.mah-table tbody tr td:first-child {
    border-left: 1px solid rgba(80, 200, 120, 0.1);
    border-radius: 8px 0 0 8px;
}

.mah-table tbody tr td:last-child {
    border-right: 1px solid rgba(80, 200, 120, 0.1);
    border-radius: 0 8px 8px 0;
}

/* =====================
   BADGES
   ===================== */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 9999px;
    border: 1px solid;
}

.badge-active {
    background: rgba(80, 200, 120, 0.15);
    color: var(--status-active);
    border-color: var(--status-active);
}

.badge-pending {
    background: rgba(255, 215, 0, 0.15);
    color: var(--status-pending);
    border-color: var(--status-pending);
}

.badge-cancelled {
    background: rgba(220, 20, 60, 0.15);
    color: var(--status-cancelled);
    border-color: var(--status-cancelled);
}

.badge-hold {
    background: rgba(255, 140, 0, 0.15);
    color: var(--status-hold);
    border-color: var(--status-hold);
}

/* =====================
   ALERTS
   ===================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid;
    backdrop-filter: blur(10px);
}

.alert-success {
    background: rgba(80, 200, 120, 0.15);
    border-color: rgba(80, 200, 120, 0.4);
    color: var(--emerald);
}

.alert-danger {
    background: rgba(220, 20, 60, 0.15);
    border-color: rgba(220, 20, 60, 0.4);
    color: #FF6B6B;
}

.alert-warning {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.4);
    color: #FFD700;
}

.alert-info {
    background: rgba(80, 200, 120, 0.1);
    border-color: rgba(80, 200, 120, 0.3);
    color: var(--text-secondary);
}

/* =====================
   GRID LAYOUTS
   ===================== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

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

.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; }

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.section {
    padding: 6rem 2rem;
}

/* =====================
   MOBILE ENHANCEMENTS
   ===================== */

/* Touch-friendly inputs and buttons */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .form-control,
    input,
    select,
    textarea,
    button {
        min-height: 44px; /* Apple & Android touch target minimum */
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .btn {
        padding: 12px 20px;
    }
}

/* Tablet breakpoint */
@media (max-width: 1199px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .container {
        max-width: 100%;
        padding: 1.5rem;
    }
}

/* Mobile breakpoint - Large phones and small tablets */
@media (max-width: 767px) {
    /* Typography scaling */
    h1 {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
    }

    h2 {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    h3 {
        font-size: clamp(1.25rem, 4vw, 1.5rem);
    }

    /* Navigation */
    .mah-nav {
        padding: 0.75rem 1rem;
    }

    .nav-container {
        padding: 0.75rem 1rem;
        border-radius: 16px;
        flex-direction: column;
        gap: 1rem;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .nav-links a {
        font-size: 0.9rem;
    }

    /* Grids */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Containers */
    .container {
        padding: 1rem;
    }

    .section {
        padding: 2rem 1rem;
    }

    /* Cards */
    .glass-card {
        padding: 1.5rem;
        border-radius: 12px;
    }

    .glass-card-flat {
        padding: 1rem;
    }

    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 15px;
    }

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

    .btn-lg {
        padding: 14px 20px;
        font-size: 16px;
    }

    /* Forms */
    .form-control {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px 14px;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }

    /* Tables - Stack on mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mah-table {
        font-size: 0.85rem;
    }

    .mah-table thead th {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }

    .mah-table tbody td {
        padding: 0.75rem 0.5rem;
    }

    /* Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
    }

    /* Alerts */
    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }

    /* Modals - Full screen on mobile */
    .modal {
        padding: 0;
    }

    .modal-content {
        max-width: 100% !important;
        width: 100% !important;
        height: 100vh;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        overflow-y: auto;
    }
}

/* Small mobile - Phones in portrait */
@media (max-width: 480px) {
    /* Further reduce text sizes */
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.35rem;
    }

    h3 {
        font-size: 1.15rem;
    }

    p {
        font-size: 0.95rem;
    }

    /* Compact spacing */
    .container {
        padding: 0.75rem;
    }

    .glass-card {
        padding: 1rem;
    }

    /* Smaller buttons */
    .btn {
        padding: 10px 14px;
        font-size: 14px;
    }

    .btn-sm {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* =====================
   LOADING SPINNER
   ===================== */
.spinner {
    border: 3px solid rgba(80, 200, 120, 0.2);
    border-top: 3px solid var(--emerald);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =====================
   MOBILE UTILITIES
   ===================== */

/* Hide on mobile */
.hide-mobile {
    display: block;
}

@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none;
}

@media (max-width: 767px) {
    .show-mobile {
        display: block !important;
    }
}

/* Mobile button groups - stack vertically */
.btn-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media (max-width: 767px) {
    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        width: 100%;
    }
}

/* Mobile-friendly flex containers */
.flex-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

@media (max-width: 767px) {
    .flex-container {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Mobile spacing utilities */
@media (max-width: 767px) {
    .mobile-mt-1 { margin-top: 0.5rem !important; }
    .mobile-mt-2 { margin-top: 1rem !important; }
    .mobile-mb-1 { margin-bottom: 0.5rem !important; }
    .mobile-mb-2 { margin-bottom: 1rem !important; }
    .mobile-p-1 { padding: 0.5rem !important; }
    .mobile-p-2 { padding: 1rem !important; }
}

/* Mobile text alignment */
@media (max-width: 767px) {
    .mobile-text-center { text-align: center !important; }
    .mobile-text-left { text-align: left !important; }
}

/* Prevent text selection on touch interfaces (for UI elements) */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Better touch scrolling */
.scroll-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* Mobile-optimized inputs */
@media (max-width: 767px) {
    input[type="search"],
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }
}

/* =====================
   MOBILE HAMBURGER MENU
   ===================== */

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}

.hamburger {
    width: 30px;
    height: 3px;
    background-color: var(--emerald);
    position: relative;
    transition: all 0.3s ease;
    border-radius: 3px;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 3px;
    background-color: var(--emerald);
    transition: all 0.3s ease;
    border-radius: 3px;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    top: 8px;
}

.mobile-menu-toggle.active .hamburger {
    background-color: transparent;
}

.mobile-menu-toggle.active .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.mobile-menu-toggle.active .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

.mobile-nav-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: linear-gradient(135deg, rgba(0, 20, 0, 0.98) 0%, rgba(0, 10, 0, 0.98) 100%);
    backdrop-filter: blur(20px);
    border-left: 2px solid rgba(80, 200, 120, 0.3);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
    padding: 80px 20px 20px;
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.mobile-nav-menu.active {
    right: 0;
}

.mobile-nav-menu a {
    display: block;
    padding: 15px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 8px;
    margin-bottom: 10px;
    background: rgba(0, 20, 0, 0.4);
    border: 1px solid rgba(80, 200, 120, 0.2);
    transition: all 0.3s ease;
}

.mobile-nav-menu a:hover {
    background: rgba(0, 30, 0, 0.6);
    border-color: var(--emerald);
    transform: translateX(-5px);
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
}

@media (max-width: 767px) {
    .mobile-menu-toggle {
        display: block;
    }

    .mobile-nav-menu,
    .mobile-nav-overlay {
        display: block;
    }

    /* Hide desktop nav on mobile when using hamburger menu */
    .nav-links.desktop-only {
        display: none;
    }
}
