/* ==========================================================================
   BorrowIn - Apple Design System Refinement
   Designed according to Apple Human Interface Guidelines (WWDC fluid UI principles)
   ========================================================================== */

@font-face {
    font-family: 'Poppins';
    src: url("../font/Poppins-Regular.ttf");
    font-display: swap;
}

@font-face {
    font-family: 'DIN';
    src: url('../font/DIN-Next-LT-Arabic.ttf');
    font-display: swap;
}

/* --------------------------------------------------------------------------
   Design Tokens - Apple Light & Dark System
   -------------------------------------------------------------------------- */
:root {
    /* Apple System Colors */
    --apple-system-blue: #0071e3;
    --apple-system-blue-hover: #0077ed;
    --apple-system-blue-active: #0062c4;
    --apple-tint: rgba(0, 113, 227, 0.08);
    --apple-tint-strong: rgba(0, 113, 227, 0.16);

    --apple-system-red: #ff3b30;
    --apple-system-red-hover: #d72e25;
    --apple-system-red-active: #b5221a;

    --apple-system-green: #34c759;

    /* Theme Surfaces (Light) */
    --background-color: #f5f5f7;
    --surface-bg: rgba(255, 255, 255, 0.82);
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.08);
    --card-hover-border: rgba(0, 0, 0, 0.14);

    --nav-bg: rgba(255, 255, 255, 0.72);
    --nav-border: rgba(0, 0, 0, 0.08);

    --text-color: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #a1a1a6;
    --heading-color: #1d1d1f;

    /* Backward compatibility mappings */
    --main-color: #1d1d1f;
    --Secondary-color: #0071e3;
    --accent-color: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.06);
    --login-hover-color: #0077ed;
    --navigation-hover-color: #0071e3;
    --box-shadow-color: rgba(0, 113, 227, 0.3);
    --Sign-up-color: #0071e3;

    /* Apple Precision Radii */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-pill: 980px;

    /* Apple Multi-layer Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 0 4px rgba(0, 113, 227, 0.2);

    /* Apple Fluid Springs & Curves */
    --spring-snappy: cubic-bezier(0.16, 1, 0.3, 1);
    --spring-smooth: cubic-bezier(0.25, 1, 0.5, 1);

    /* Apple System Font Stack */
    --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "SF Pro", "Poppins", sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "SF Pro", "DIN", "Poppins", sans-serif;
}

/* Apple Pure Dark Mode */
.darkmode {
    --apple-system-blue: #2997ff;
    --apple-system-blue-hover: #47a6ff;
    --apple-system-blue-active: #147ce5;
    --apple-tint: rgba(41, 151, 255, 0.12);
    --apple-tint-strong: rgba(41, 151, 255, 0.22);

    --apple-system-red: #ff453a;
    --apple-system-red-hover: #ff6961;
    --apple-system-red-active: #d72e25;

    --apple-system-green: #30d158;

    /* Surfaces (OLED / Space Gray hierarchy) */
    --background-color: #000000;
    --surface-bg: rgba(28, 28, 30, 0.82);
    --card-bg: #1c1c1e;
    --card-border: rgba(255, 255, 255, 0.12);
    --card-hover-border: rgba(255, 255, 255, 0.24);

    --nav-bg: rgba(28, 28, 30, 0.75);
    --nav-border: rgba(255, 255, 255, 0.12);

    --text-color: #f5f5f7;
    --text-secondary: #86868b;
    --text-tertiary: #6e6e73;
    --heading-color: #f5f5f7;

    /* Backward compatibility mappings */
    --main-color: #f5f5f7;
    --Secondary-color: #2997ff;
    --accent-color: #1c1c1e;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --login-hover-color: #47a6ff;
    --navigation-hover-color: #2997ff;
    --box-shadow-color: rgba(41, 151, 255, 0.3);
    --Sign-up-color: #2997ff;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.7);
    --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.8);
    --shadow-glow: 0 0 0 4px rgba(41, 151, 255, 0.25);
}

/* --------------------------------------------------------------------------
   Base Styles & Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--font-system);
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    transition: background-color 0.35s ease, color 0.35s ease;
}

/* --------------------------------------------------------------------------
   Translucent Chrome & Header
   -------------------------------------------------------------------------- */
.nav-bg {
    background-color: var(--nav-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    border-bottom: 1px solid var(--nav-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    z-index: 1000;
    transition: background-color 0.35s ease, border-color 0.35s ease;
}

/* Logo */
h2 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.02em;
    position: fixed;
    top: 0;
    left: 28px;
    height: 64px;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    z-index: 1001;
    line-height: 1;
}

h2 a {
    text-decoration: none;
    color: var(--text-color);
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s ease, transform 0.2s var(--spring-snappy);
}

h2 a:hover {
    opacity: 0.85;
}

h2 a:active {
    transform: scale(0.97);
}

/* Centered Navigation Menu */
nav {
    font-family: var(--font-system);
    font-size: 14px;
    font-weight: 500;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    pointer-events: auto;
}

.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 4px;
    gap: 4px;
    background: rgba(120, 120, 128, 0.06);
    border-radius: var(--radius-pill);
    border: 1px solid rgba(120, 120, 128, 0.08);
}

.darkmode .nav-menu {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}

nav ul li {
    display: inline-flex;
    margin: 0;
    padding: 0;
}

nav a, .nav-menu a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13.5px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    transition: color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
    display: inline-block;
}

nav a:hover, .nav-menu a:hover {
    color: var(--text-color);
    background-color: rgba(120, 120, 128, 0.1);
}

.darkmode nav a:hover, .darkmode .nav-menu a:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

nav a:active, .nav-menu a:active {
    transform: scale(0.96);
}

/* --------------------------------------------------------------------------
   Auth & User Controls (Right-aligned in Navbar)
   -------------------------------------------------------------------------- */
.login-button {
    font-family: var(--font-system);
    font-size: 13px;
    font-weight: 500;
    color: var(--apple-system-blue);
    background-color: var(--apple-tint);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    box-shadow: none;
    position: fixed;
    width: auto;
    min-width: 68px;
    height: 32px;
    padding: 0 14px;
    right: 28px;
    top: 16px;
    z-index: 1001;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s var(--spring-snappy), box-shadow 0.2s ease;
}

.login-button:hover {
    background-color: var(--apple-system-blue);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.login-button:active {
    transform: scale(0.96);
}

.signup-button {
    font-family: var(--font-system);
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    background-color: var(--apple-system-blue);
    border: none;
    border-radius: var(--radius-pill);
    box-shadow: 0 2px 6px rgba(0, 113, 227, 0.24);
    position: fixed;
    width: auto;
    min-width: 76px;
    height: 32px;
    padding: 0 16px;
    right: 106px;
    top: 16px;
    z-index: 1001;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.15s var(--spring-snappy), box-shadow 0.2s ease;
}

.signup-button:hover {
    background-color: var(--apple-system-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.35);
}

.signup-button:active {
    transform: scale(0.96);
}

.logout-button {
    font-family: var(--font-system);
    font-size: 13px;
    font-weight: 500;
    color: var(--apple-system-red);
    background-color: rgba(255, 59, 48, 0.08);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    box-shadow: none;
    position: fixed;
    width: auto;
    min-width: 72px;
    height: 32px;
    padding: 0 14px;
    right: 28px;
    top: 16px;
    z-index: 1001;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s var(--spring-snappy);
}

.logout-button:hover {
    background-color: var(--apple-system-red);
    color: #ffffff;
    transform: translateY(-1px);
}

.logout-button:active {
    transform: scale(0.96);
}

/* Apple Design Navbar User Capsule (Profile & Logout) */
.user-info, .user-capsule {
    position: fixed;
    top: 12px;
    right: 28px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 3px 6px 3px 12px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 980px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
    z-index: 1001;
    transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.user-avatar-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0071e3 0%, #42a5f5 100%);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 113, 227, 0.35);
}

.user-greeting {
    margin: 0 !important;
    color: var(--text-color) !important;
    font-size: 13.5px;
    font-weight: 450;
    font-family: var(--font-system);
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.user-greeting strong {
    font-weight: 600;
    color: var(--heading-color);
    margin-left: 3px;
}

.logout-pill-btn, .logout-button {
    font-family: var(--font-system);
    font-size: 12px;
    font-weight: 600;
    color: var(--apple-system-red);
    background-color: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.22);
    border-radius: 980px;
    height: 30px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    white-space: nowrap;
    position: static !important;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.logout-pill-btn:hover, .logout-button:hover {
    background-color: var(--apple-system-red);
    color: #ffffff;
    border-color: var(--apple-system-red);
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.35);
}

.logout-pill-btn:active, .logout-button:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .user-info, .user-capsule {
        right: 14px;
        top: 12px;
        gap: 6px;
        padding: 3px 5px 3px 8px;
    }
    .user-greeting {
        font-size: 12px;
    }
}

.danger-button {
    font-family: var(--font-system);
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    background-color: var(--apple-system-red);
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 6px rgba(255, 59, 48, 0.25);
    cursor: pointer;
    padding: 8px 16px;
    transition: background-color 0.2s ease, transform 0.15s var(--spring-snappy), box-shadow 0.2s ease;
}

.danger-button:hover {
    background-color: var(--apple-system-red-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(255, 59, 48, 0.35);
}

.danger-button:active {
    transform: scale(0.97);
}

/* --------------------------------------------------------------------------
   Apple Floating Theme Toggle
   -------------------------------------------------------------------------- */
#Theme-toggle {
    height: 44px;
    width: 44px;
    padding: 0;
    border: 1px solid var(--card-border);
    border-radius: 50%;
    background-color: var(--surface-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    cursor: pointer;
    transition: transform 0.25s var(--spring-snappy), box-shadow 0.25s ease, background-color 0.3s ease, border-color 0.3s ease;
}

#Theme-toggle:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--card-hover-border);
}

#Theme-toggle:active {
    transform: scale(0.94);
}

#Theme-toggle svg {
    fill: var(--text-color);
    transition: fill 0.3s ease, transform 0.4s var(--spring-snappy);
    width: 20px;
    height: 20px;
}

#Theme-toggle svg:last-child {
    display: none;
}

.darkmode #Theme-toggle svg:first-child {
    display: none;
}

.darkmode #Theme-toggle svg:last-child {
    display: block;
}

/* --------------------------------------------------------------------------
   Headings & Display Typography
   -------------------------------------------------------------------------- */
h1 {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    position: relative;
    width: 100%;
    text-align: center;
    margin: 32px auto 36px;
    color: var(--heading-color);
    z-index: 1;
}

.home-h1 {
    color: var(--text-color);
    opacity: 0.95;
    font-weight: 700;
    letter-spacing: -0.03em;
}

h3 {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--heading-color);
    margin-bottom: 12px;
}

h4 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--heading-color);
    margin-bottom: 8px;
}

/* --------------------------------------------------------------------------
   Main Content Layout
   -------------------------------------------------------------------------- */
.content-container {
    padding-top: 84px;
    padding-bottom: 80px;
    min-height: calc(100vh - 64px);
    z-index: 2;
    position: relative;
}

/* Home Background Video & Scrim */
html:has(.home-bgvid), body:has(.home-bgvid) {
    background-color: transparent !important;
    background: transparent !important;
}

.home-bgvid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: 0;
    filter: brightness(0.92);
    pointer-events: none;
}

.darkmode .home-bgvid {
    filter: brightness(0.65) contrast(1.1);
}

/* Scrim overlay for home readability */
body:has(.home-bgvid)::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(245, 245, 247, 0.25) 0%, rgba(245, 245, 247, 0.7) 100%);
    pointer-events: none;
    z-index: 1;
}

.darkmode:has(.home-bgvid)::before {
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.8) 100%);
}

/* --------------------------------------------------------------------------
   Search Input (Apple Spotlight Style)
   -------------------------------------------------------------------------- */
.input, #searchInput {
    position: relative;
    display: block;
    margin: 0 auto 36px auto;
    width: 100%;
    max-width: 460px;
    background-color: var(--surface-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-color);
    padding: 12px 18px 12px 42px;
    min-height: 46px;
    border-radius: var(--radius-md);
    outline: none;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-system);
    font-size: 15px;
    letter-spacing: -0.01em;
    left: auto;
    bottom: auto;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, transform 0.2s var(--spring-snappy);
}

.input::placeholder, #searchInput::placeholder {
    color: var(--text-secondary);
    opacity: 0.85;
}

.input:focus, #searchInput:focus {
    background-color: var(--card-bg);
    border-color: var(--apple-system-blue);
    box-shadow: var(--shadow-glow), var(--shadow-sm);
}

.input:hover:not(:focus), #searchInput:hover:not(:focus) {
    border-color: var(--card-hover-border);
}

/* --------------------------------------------------------------------------
   Book Cards & Grid Layout (Apple Card Design)
   -------------------------------------------------------------------------- */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 28px;
    position: relative;
    margin-top: 36px;
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 32px;
    z-index: 1;
}

.card {
    margin: 0;
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    overflow: hidden;
    background-color: var(--card-bg);
    box-shadow: var(--shadow-sm);
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.35s var(--spring-snappy), box-shadow 0.35s ease, border-color 0.3s ease;
    will-change: transform;
}

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

.card:active {
    transform: translateY(-3px) scale(0.99);
}

.card-img-top {
    width: 100%;
    height: 270px;
    object-fit: cover;
    background-color: rgba(120, 120, 128, 0.05);
    border-bottom: 1px solid var(--card-border);
    transition: transform 0.5s var(--spring-smooth);
    display: block;
}

.card:hover .card-img-top {
    transform: scale(1.025);
}

.card-body {
    padding: 20px;
    z-index: 2;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.card-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.015em;
    line-height: 1.35;
    color: var(--heading-color);
    margin-bottom: 10px;
}

.card-text {
    color: var(--text-secondary);
    font-family: var(--font-system);
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
}

.card-text strong {
    color: var(--text-color);
    font-weight: 550;
}

/* --------------------------------------------------------------------------
   Trending Slider (Now Trending on Home Page)
   -------------------------------------------------------------------------- */
#sliderWrap {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 24px;
    overflow: hidden;
}

#sliderTrack {
    display: flex;
    gap: 24px;
    transition: transform 0.5s var(--spring-smooth);
    will-change: transform;
    align-items: center;
}

.slide-card {
    flex: 0 0 auto;
    width: 18rem;
    transition: transform 0.45s var(--spring-smooth), opacity 0.45s ease, filter 0.45s ease;
    filter: saturate(0.85);
    opacity: 0.45;
    transform: scale(0.92);
}

.slide-card.active {
    filter: none;
    opacity: 1;
    transform: scale(1.06);
}

.slide-card.neighbor {
    opacity: 0.75;
    transform: scale(0.97);
}

.slide-card.far {
    opacity: 0.2;
    transform: scale(0.88);
}

.slide-card a {
    pointer-events: auto !important;
    cursor: pointer !important;
    text-decoration: none;
    display: block;
}

.slide-card.active a {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Apple Circular Slider Buttons */
#sliderPrev, #sliderNext {
    width: 44px;
    height: 44px;
    border-radius: 50% !important;
    background-color: var(--surface-bg) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid var(--card-border) !important;
    box-shadow: var(--shadow-md) !important;
    color: var(--text-color) !important;
    font-family: var(--font-system) !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 100 !important;
    transition: transform 0.2s var(--spring-snappy), box-shadow 0.2s ease, background-color 0.2s ease !important;
}

#sliderPrev:hover, #sliderNext:hover {
    background-color: var(--card-bg) !important;
    transform: translateY(-50%) scale(1.08) !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--apple-system-blue) !important;
}

#sliderPrev:active, #sliderNext:active {
    transform: translateY(-50%) scale(0.94) !important;
}

/* --------------------------------------------------------------------------
   Borrow Page Tables & Forms
   -------------------------------------------------------------------------- */
.borrow-form-container,
div[style*="max-width:800px;margin:30px auto;"] {
    background: var(--card-bg) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md) !important;
    padding: 32px !important;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

div[style*="max-width:1000px;margin:30px auto;"] {
    margin-top: 40px !important;
}

/* --------------------------------------------------------------------------
   Apple Design Pop-Up Button / Select Dropdown
   -------------------------------------------------------------------------- */
select, .apple-select {
    width: 100%;
    height: 48px;
    padding: 0 44px 0 16px;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: var(--radius-md); /* 14px Apple squircle */
    font-family: var(--font-system);
    font-size: 14.5px;
    font-weight: 450;
    line-height: 46px;
    background-color: rgba(255, 255, 255, 0.9);
    color: #1d1d1f;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 14px 14px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

select:hover, .apple-select:hover {
    border-color: rgba(0, 0, 0, 0.28);
    background-color: #ffffff;
}

select:focus, .apple-select:focus {
    border-color: var(--apple-system-blue);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.25);
    background-color: #ffffff;
}

select:active, .apple-select:active {
    transform: scale(0.995);
}

/* Options dropdown menu styling */
select option, .apple-select option {
    background-color: #ffffff;
    color: #1d1d1f;
    padding: 12px 16px;
    font-size: 14.5px;
    font-family: var(--font-system);
}

/* Dark Mode Apple Pop-Up Button (Pure OLED Dark Style) */
.darkmode select, .darkmode .apple-select {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #f5f5f7 !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398989d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}

.darkmode select:hover, .darkmode .apple-select:hover {
    background-color: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.darkmode select:focus, .darkmode .apple-select:focus {
    border-color: var(--apple-system-blue) !important;
    box-shadow: 0 0 0 4px rgba(41, 151, 255, 0.3) !important;
    background-color: #1c1c1e !important;
}

.darkmode select option, .darkmode .apple-select option {
    background-color: #1c1c1e !important;
    color: #f5f5f7 !important;
}

/* Tables (Apple Settings / Numbers Style) */
.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-color);
    vertical-align: middle;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-md) !important;
    overflow: hidden;
    border: 1px solid var(--card-border) !important;
    background-color: var(--card-bg) !important;
    box-shadow: var(--shadow-sm);
}

.table thead th {
    background-color: rgba(120, 120, 128, 0.05) !important;
    color: var(--text-secondary) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 20px !important;
    border-bottom: 1px solid var(--card-border) !important;
    border-top: none !important;
}

.table tbody td {
    padding: 16px 20px !important;
    border-bottom: 1px solid var(--card-border) !important;
    background-color: transparent !important;
    color: var(--text-color) !important;
    font-size: 14px;
}

.table tbody tr:last-child td {
    border-bottom: none !important;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: rgba(120, 120, 128, 0.04) !important;
}

/* Countdown Badge */
.countdown {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background-color: var(--apple-tint);
    color: var(--apple-system-blue);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border-radius: var(--radius-pill);
    letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   Footer (Apple Clean Minimalist Style)
   -------------------------------------------------------------------------- */
footer {
    background-color: #1d1d1f !important;
    color: #86868b !important;
    font-family: var(--font-system);
    font-size: 12.5px;
    padding-top: 56px !important;
    padding-bottom: 36px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 10;
}

.darkmode footer {
    background-color: #0c0c0d !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

footer h3 {
    color: #f5f5f7 !important;
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

footer h4 {
    color: #f5f5f7 !important;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

footer p {
    color: #86868b !important;
    font-size: 12.5px;
    line-height: 1.6;
}

footer ul li {
    padding: 3px 0 !important;
    color: #86868b;
    font-size: 12.5px;
}

footer ul li a, ul li a {
    text-decoration: none;
    color: #86868b !important;
    transition: color 0.15s ease;
}

footer ul li a:hover, ul li a:hover {
    color: #f5f5f7 !important;
    text-decoration: none;
}

hr.color {
    background-color: rgba(255, 255, 255, 0.12) !important;
    border: none;
    height: 1px;
    margin: 36px 0 24px 0;
}

/* Social icons in footer */
footer .bi {
    transition: color 0.2s ease, transform 0.2s var(--spring-snappy);
    display: inline-block;
}

footer a:hover .bi {
    color: var(--apple-system-blue) !important;
    transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Accessibility & Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (prefers-reduced-transparency: reduce) {
    .nav-bg, #Theme-toggle, .card, select, .input {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background-color: var(--card-bg) !important;
    }
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
    nav {
        position: static;
        transform: none;
        height: auto;
        margin-top: 14px;
        justify-content: center;
    }

    .content-container {
        padding-top: 130px;
    }

    .nav-bg {
        height: 110px;
    }
}

@media (max-width: 640px) {
    h1 {
        font-size: 2rem;
    }

    .card-container {
        padding: 0 16px;
        gap: 20px;
    }

    h2 {
        left: 16px;
    }

    .user-info, .signup-button, .login-button {
        right: 16px;
    }
}
