/* Global responsive system layer (mobile-first) */
:root {
    --pd-font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --pd-color-bg: #f8f9fa;
    --pd-color-surface: #ffffff;
    --pd-color-text: #1f2937;
    --pd-color-muted: #6b7280;
    --pd-color-primary: #8e44ad;
    --pd-color-accent: #e67e22;
    --pd-color-border: #e5e7eb;
    --pd-radius-sm: 0.5rem;
    --pd-radius-md: 0.75rem;
    --pd-radius-lg: 1rem;
    --pd-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
    --pd-shadow-md: 0 10px 24px rgba(15, 23, 42, 0.14);
}

html {
    font-size: 16px;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--pd-font-sans);
    color: var(--pd-color-text);
    background: var(--pd-color-bg);
    overflow-x: hidden;
}

h1 {
    font-size: clamp(1.6rem, 5.2vw, 2.4rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h2 {
    font-size: clamp(1.4rem, 4.6vw, 2rem);
    line-height: 1.25;
}

h3 {
    font-size: clamp(1.2rem, 4vw, 1.6rem);
    line-height: 1.3;
}

h4,
h5,
h6 {
    line-height: 1.35;
}

p,
li,
label,
input,
select,
textarea,
button {
    font-size: clamp(0.94rem, 2.8vw, 1rem);
    line-height: 1.6;
}

img,
video,
canvas,
svg {
    max-width: 100%;
}

img:not([height]) {
    height: auto;
}

.container,
.container-fluid {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
}

/* Unified interactive system */
.btn,
button,
a.btn,
.nav-link,
.dropdown-item,
.form-control,
.form-select,
input[type="button"],
input[type="submit"],
input[type="reset"] {
    min-height: 44px;
    min-width: 44px;
    border-radius: var(--pd-radius-md);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn,
a.btn {
    border: 1px solid transparent;
    box-shadow: var(--pd-shadow-sm);
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover,
a.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--pd-shadow-md);
}

.btn:active,
a.btn:active {
    transform: translateY(0);
}

.card,
.modal-content,
.dropdown-menu,
.table,
.alert {
    border-radius: var(--pd-radius-md);
}

.card,
.modal-content,
.dropdown-menu {
    border: 1px solid var(--pd-color-border);
}

.card,
.table-responsive,
.modal-content {
    box-shadow: var(--pd-shadow-sm);
}

.form-control,
.form-select {
    border: 1px solid #d1d5db;
    padding: 0.625rem 0.875rem;
    font-size: 16px;
}

.form-control:focus,
.form-select:focus,
.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible {
    outline: 2px solid rgba(142, 68, 173, 0.45);
    outline-offset: 2px;
    box-shadow: 0 0 0 0.25rem rgba(142, 68, 173, 0.2);
}

/* Navigation and dropdown stability */
.navbar,
.eduvista-nav,
.admin-topbar {
    z-index: 1030;
}

.dropdown-menu {
    z-index: 1045;
    overflow: hidden;
}

/* Responsive table behavior */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
    min-width: 640px;
}

.table th,
.table td {
    vertical-align: middle;
    white-space: nowrap;
}

/* Grid and overflow hardening */
.row {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

[class*="col-"] {
    min-width: 0;
}

.card-body,
.modal-body {
    overflow-wrap: anywhere;
}

/* Touch devices: disable heavy hover transforms */
@media (hover: none) and (pointer: coarse) {
    .card:hover,
    .btn:hover,
    .nav-link:hover,
    .dropdown-item:hover {
        transform: none;
    }
}

/* 320px+ */
@media (min-width: 320px) {
    :root {
        --pd-radius-md: 0.7rem;
    }
}

/* 768px+ */
@media (min-width: 768px) {
    .container,
    .container-fluid {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .btn,
    a.btn {
        padding: 0.65rem 1.1rem;
    }

    .table {
        min-width: 0;
    }
}

/* 1024px+ */
@media (min-width: 1024px) {
    h1 {
        font-size: clamp(2rem, 2.9vw, 2.75rem);
    }

    h2 {
        font-size: clamp(1.7rem, 2.2vw, 2.2rem);
    }

    .container,
    .container-fluid {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* 1440px+ */
@media (min-width: 1440px) {
    .container {
        max-width: 1320px;
    }

    h1 {
        font-size: 3rem;
    }
}
