/* Global mobile-first polish for app-like experience */

:root {
    --app-bg: #000000;
    --app-surface: #141414;
    --app-surface-2: #1f1f1f;
    --app-border: #333333;
    --app-primary: #dc3545;
    --app-text: #ffffff;
    --app-muted: #b8b8b8;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

.container,
.container-fluid {
    padding-left: 14px;
    padding-right: 14px;
}

.card,
.modal-content,
.dropdown-menu {
    border-radius: 14px;
}

.btn,
.form-control,
.form-select,
.form-check-input,
.nav-link,
.dropdown-item {
    min-height: 42px;
}

.btn {
    border-radius: 10px;
}

.form-control,
.form-select {
    border-radius: 10px;
}

.table-responsive {
    border-radius: 12px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-dialog {
    margin: 0.6rem;
}

.modal-content {
    max-height: calc(100dvh - 1.2rem);
}

.modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.badge {
    border-radius: 999px;
}

@media (max-width: 992px) {
    .navbar .navbar-collapse {
        margin-top: 10px;
        padding: 10px;
        border-radius: 10px;
        background: rgba(0, 0, 0, 0.88);
    }

    .row > [class*="col-"] {
        margin-bottom: 10px;
    }
}

@media (max-width: 768px) {
    .container,
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    .card,
    .modal-content {
        border-radius: 12px;
    }

    .card-body,
    .card-header,
    .modal-body,
    .modal-header,
    .modal-footer {
        padding: 12px;
    }

    h1, .h1 { font-size: 1.45rem; }
    h2, .h2 { font-size: 1.3rem; }
    h3, .h3 { font-size: 1.2rem; }
    h4, .h4 { font-size: 1.05rem; }

    .table {
        font-size: 0.86rem;
    }

    .table td,
    .table th {
        white-space: nowrap;
        padding: 8px 6px;
    }

    .btn-lg {
        padding: 0.62rem 0.8rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    body {
        /* Extra breathing room for WebViews with bottom bars */
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .container,
    .container-fluid {
        padding-left: 8px;
        padding-right: 8px;
    }

    .btn,
    .form-control,
    .form-select {
        font-size: 16px; /* avoids iOS zoom */
    }

    .btn {
        width: 100%;
    }

    .btn-group .btn,
    .btn-group > .dropdown {
        width: auto;
        flex: 1 1 auto;
    }

    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100dvh;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100dvh;
        max-height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        flex: 1 1 auto;
        min-height: 0;
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }

    .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 2;
        background: var(--app-surface-2);
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .navbar-brand {
        font-size: 1rem;
    }
}

/* Fallback for browsers without dvh support */
@supports not (height: 100dvh) {
    @media (max-width: 576px) {
        .modal-dialog {
            height: 100vh;
        }

        .modal-content {
            min-height: 100vh;
            max-height: 100vh;
        }
    }
}

