@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #030718;
    --secondary: #3b82f6;
    --secondary-hover: #2563eb;
    --accent: #ffffff;
    --bg-color: #f4f7fb;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--primary);
    font-weight: 600;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.text-center {
    text-align: center;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

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

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

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

.btn-outline:hover {
    background-color: var(--secondary);
    color: var(--accent);
}

.btn-block {
    width: 100%;
}

/* Form inputs */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--card-bg);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Auth Layout */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, #1e293b 100%);
}

.auth-card {
    background-color: var(--card-bg);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    transform: translateY(20px);
    opacity: 0;
    animation: fadeUp 0.6s forwards ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.auth-logo span {
    color: var(--secondary);
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* PIN Input Grid */
.pin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.pin-btn {
    background-color: #f1f5f9;
    border: none;
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 1.5rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.pin-btn:hover,
.pin-btn:active {
    background-color: var(--secondary);
    color: white;
}

.pin-display {
    text-align: center;
    letter-spacing: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    height: 3rem;
    color: var(--primary);
}

/* Animations */
@keyframes fadeUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    transition: var(--transition);
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header span {
    color: var(--secondary);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
}

.nav-item:hover,
.nav-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left: 4px solid var(--secondary);
}

.nav-item i {
    margin-right: 1rem;
    font-size: 1.2rem;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
    transition: var(--transition);
}

/* Mobile Bottom Nav */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    justify-content: space-around;
    padding: 0.75rem 0;
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
    transition: var(--transition);
    flex: 1;
    text-align: center;
    gap: 4px;
}

.bottom-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.bottom-nav-item.active {
    color: var(--secondary);
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
        padding-bottom: 5rem;
    }

    .bottom-nav {
        display: flex;
    }

    .bottom-nav-item.logout {
        color: var(--danger);
    }
}

/* Persistent Header */
.app-header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    padding: 0.75rem 1.25rem;
    z-index: 1001;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand {
    display: flex;
    flex-direction: column;
}

.brand-main {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}

.brand-main span {
    color: var(--secondary);
}

.brand-sub {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* Alerts / Sweet Messages */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    animation: fadeUp 0.3s ease-out;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.card-title {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary);
}

/* Status Pills */
.pill {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pill-active {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.pill-inactive {
    background-color: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
}

/* iPhone 5 & Small Device Optimizations */
@media (max-width: 360px) {
    .app-header {
        padding: 0.6rem 0.8rem;
    }
    .brand-main {
        font-size: 0.95rem;
    }
    .welcome-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem;
    }
    .welcome-section h1 {
        font-size: 1.3rem !important;
    }
    .tier-badge-compact {
        align-self: flex-start;
    }
    .clock-card .time {
        font-size: 1.6rem !important;
    }
    .bottom-nav-item {
        font-size: 0.6rem;
    }
    .bottom-nav-item i {
        font-size: 1.1rem;
    }
}