/* App Shell Layout */
:root {
    --app-primary: #008AFF;
    --app-bg: #f5f5f7;
    --app-card-bg: #ffffff;
    --app-text: #222222;
    --app-nav-height: 50px;
    --app-header-height: 60px;
    --app-header-bg: #171347; /* Dark Blue from original theme */
    --app-header-text: #ffffff;
}

/* Primary Color Overrides */
.text-primary {
    color: var(--app-primary) !important;
}

.btn-primary {
    background-color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
}

.btn-primary:hover, .btn-primary:active, .btn-primary:focus {
    background-color: #0069d9 !important; /* Slightly darker for hover */
    border-color: #0062cc !important;
}

.btn-outline-primary {
    color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
}

.btn-outline-primary:hover {
    background-color: var(--app-primary) !important;
    color: #fff !important;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--app-primary);
}

/* Specific override if h1 has text-primary class already, or simply forces all headers */
h1 {
    color: var(--app-primary) !important;
}

/* Nav Pills Primary Color Override */
.nav-pills .nav-link.active, 
.nav-pills .show > .nav-link {
    background-color: var(--app-primary) !important;
    color: #fff !important;
}

.nav-pills .nav-link {
    color: var(--app-primary); 
    background-color: transparent;
}

.nav-pills .nav-link:hover {
    color: #0069d9;
}

body {
    background-color: var(--app-bg);
    margin: 0;
    padding: 0;
    overflow: hidden; 
    font-family: 'Inter', sans-serif !important; /* Force Inter */
    -webkit-font-smoothing: antialiased;
    /* Global Background */
    background-image: url('../img/bg5.jpg'); /* Relative to css file location */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
}

/* Header */
.app-header {
    height: var(--app-header-height);
    background-color: var(--app-header-bg);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    flex-shrink: 0;
    z-index: 1020;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.app-header-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--app-header-text);
}

/* Main Content Area */
.app-main-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* Smooth scroll iOS */
    position: relative;
    position: relative;
    padding-bottom: calc(var(--app-nav-height) + 25px); /* Space for fixed footer */
    display: flex;
    flex-direction: column;
}

/* Ensure footer content is pushed down if content is short, 
   but since we use scroll wrapper, footer just follows flow inside wrapper */
.app-footer-content {
    margin-top: auto;
    background-color: transparent !important; /* Override bg-dark if needed or keep */
    color: #6c757d;
    padding: 0.5rem 0;
}

/* Bottom Navigation */
.app-bottom-nav {
    height: auto; /* Allow growth for safe area */
    min-height: var(--app-nav-height);
    width: 100%;
    background-color: #ffffff !important; /* Force opaque background */
    border-top: 1px solid #cccccc; /* More visible border */
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-shrink: 0;
    z-index: 2147483647; /* Max Z-Index to beat everything */
    padding-top: 4px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateZ(0); /* Promote to layer */
}

/* Reset Body to normal to avoid viewport clipping bugs */
html, body {
    height: 100%;
    width: 100%;
    overflow: hidden; /* Keep hidden to let app-shell scroll */
    position: relative;
    background-color: var(--app-bg);
}

.app-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #555555 !important; /* Force visibility */
    opacity: 1 !important;
    font-size: 0.7rem;
    flex: 1;
    height: 100%;
}

.app-nav-item:hover, .app-nav-item:active {
    text-decoration: none;
    color: var(--app-primary);
    background-color: rgba(0,0,0,0.02);
}

.app-nav-item.active {
    color: var(--app-primary) !important;
    font-weight: 600;
}

.app-nav-icon {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

/* Components Overrides */

/* Buttons */
.btn {
    border-radius: 999px !important; /* Pill shape */
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: none;
}

.btn:active {
    transform: scale(0.96);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-primary {
    background-color: var(--app-primary) !important;
    color: #fff !important;
}

.btn-secondary, .btn-outline-secondary {
    border: 1px solid #ddd !important;
    background-color: transparent;
    color: #555 !important;
    box-shadow: none;
}

/* Cards */
.app-card {
    background-color: var(--app-card-bg);
    border-radius: 16px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: none; /* Remove bootstrap borders */
    padding: 1.5rem;
    margin-bottom: 1rem;
}

/* Glassmorphism Variant */
.app-card-glass {
    background-color: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Typography tweaks */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif !important;
    letter-spacing: -0.02em;
    font-weight: 600;
    color: #1a1a1a;
}

/* Mobile-First Heading Sizes */
h1 { font-size: 1.75rem; line-height: 1.2; } /* Mobile */
h2 { font-size: 1.5rem; line-height: 1.3; }
h3 { font-size: 1.25rem; line-height: 1.4; }
h4 { font-size: 1.1rem; line-height: 1.5; }
h5 { font-size: 1rem; font-weight: 600; }
h6 { font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

@media (min-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
}

/* Hide legacy elements if needed */
.header-height { display: none !important; } /* We handle spacing via flex */

/* Fix Bootstrap Container in Full Height App */
.container {
    max-width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
@media(min-width: 768px) {
    .container { max-width: 960px; margin: 0 auto; }
}

/* Contrast Improvements */
.text-muted {
    color: #555555 !important; /* Darker than default bootstrap gray */
}

.text-secondary {
    color: #4a5568 !important; /* Darker Slate */
}

/* App Text Variable Override */
:root {
    --app-text: #222222; /* Near black */
}

/* FontAwesome Helper (if icon- classes used instead of fas) */
[class^="icon-"] {
    font-family: 'Open Sans', sans-serif !important; /* Reset if collision, but usually existing is fine */
}
