/* 
 * Address Gateway - Premium Design System 
 * Theme: Modern Future Professional
 */

:root {
    /* Color Palette */
    --primary: #4F46E5;
    /* Indigo 600 */
    --primary-light: #818CF8;
    --secondary: #10B981;
    /* Emerald 500 */
    --accent: #F43F5E;
    /* Rose 500 */

    --bg-dark: #0f172a;
    /* Slate 900 */
    --bg-card: rgba(30, 41, 59, 0.7);
    /* Slate 800 with opacity */
    --bg-card-hover: rgba(51, 65, 85, 0.8);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    background-size: cover;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    /* Changed for mobile first */
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(to right, #818CF8, #C084FC);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* Layout */
#app {
    display: flex;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    min-height: 100vh;
}

/* Login Screen */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    /* Solid bg fallback */
    background-image: inherit;
    /* Use body gradient */
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(20px);
    border: var(--glass-border);
    padding: 3rem;
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.8s ease-out;
}

/* Mobile Header */
.mobile-header {
    display: none;
    /* Hidden on desktop */
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    border-right: var(--glass-border);
    padding: 2rem;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 40;
}

.brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.brand.desktop-only {
    display: flex;
}

.nav-item {
    padding: 1rem;
    cursor: pointer;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.2) 0%, transparent 100%);
    border-left: 3px solid var(--primary);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    overflow-x: hidden;
    /* Prevent horizontal scroll on main */
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.card-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.card-value {
    font-size: 2.5rem;
    font-weight: 700;
    word-break: break-all;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    margin-top: 2rem;
    overflow-x: auto;
    /* Enable horizontal scroll for tables */
}

.styled-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
    min-width: 600px;
    /* Force scroll on small screens */
}

.styled-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.styled-table td {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
}

.styled-table tr td:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.styled-table tr td:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.styled-table tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

/* Badge */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.status-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.status-danger {
    background: rgba(244, 63, 94, 0.2);
    color: #f43f5e;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: var(--font-body);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.6);
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    border: none;
}

/* Inputs */
input,
select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: white;
    width: 100%;
    margin-bottom: 1rem;
    font-family: var(--font-body);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: #1e293b;
    padding: 2rem;
    border-radius: 20px;
    border: var(--glass-border);
    width: 90%;
    max-width: 500px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeIn 0.5s ease forwards;
}

/* --- MEDIA QUERIES --- */
@media (max-width: 1024px) {
    #app {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
        /* Show header on mobile */
    }

    .brand.desktop-only {
        display: none;
        /* Hide brand inside sidebar since it's in header */
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 60px;
        /* Height of mobile header roughly */
        height: calc(100vh - 60px);
        transform: translateX(-100%);
        /* Hide by default */
        width: 100%;
        /* Full width menu on mobile */
        max-width: 300px;
        background: rgba(15, 23, 42, 0.95);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        padding: 1.5rem;
        margin-top: 0;
        /* Header takes care */
    }

    h1 {
        font-size: 2rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
        /* Stack cards */
        gap: 1rem;
    }

    .card-value {
        font-size: 2rem;
    }
}