/**
 * Filename: css/base.css
 * Author: Academic Network
 * Version: 1.0.0
 * Description: Base styles, CSS reset, and global element styles
 * Last Modified: 2025-10-27
 */

/* ============================================
 * MODERN CSS RESET
 * Based on modern-normalize and custom additions
 * ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Remove default margin and padding */
html,
body,
div,
span,
applet,
object,
iframe,
h1, h2, h3, h4, h5, h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
    display: block;
}

/* ============================================
 * ROOT ELEMENT STYLES
 * ============================================ */

html {
    /* Prevent font size adjustment after orientation changes in iOS */
    -webkit-text-size-adjust: 100%;

    /* Set default font size (1rem = 16px) */
    font-size: 16px;

    /* Smooth scrolling */
    scroll-behavior: smooth;

    /* Better font rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    /* Set default line height */
    line-height: 1.15;
}

/* Respect user's reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* ============================================
 * BODY STYLES
 * ============================================ */

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background-color: var(--bg-secondary);

    /* Prevent horizontal scroll */
    overflow-x: hidden;

    /* Better text rendering */
    text-rendering: optimizeSpeed;

    /* Minimum height */
    min-height: 100vh;

    /* Prevent text inflation on mobile */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* ============================================
 * TYPOGRAPHY
 * ============================================ */

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

h1 {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-lg);
}

h2 {
    font-size: var(--font-size-2xl);
}

h3 {
    font-size: var(--font-size-xl);
}

h4 {
    font-size: var(--font-size-lg);
}

h5 {
    font-size: var(--font-size-md);
}

h6 {
    font-size: var(--font-size-base);
}

/* Paragraphs */
p {
    margin-bottom: var(--spacing-md);
    line-height: var(--line-height-relaxed);
}

p:last-child {
    margin-bottom: 0;
}

/* Text emphasis */
strong,
b {
    font-weight: var(--font-weight-bold);
}

em,
i {
    font-style: italic;
}

small {
    font-size: var(--font-size-sm);
}

/* Code and preformatted text */
code,
kbd,
samp,
pre {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
}

code {
    padding: 0.125rem 0.25rem;
    background-color: var(--color-gray-100);
    border-radius: var(--radius-sm);
    color: var(--color-danger);
}

pre {
    padding: var(--spacing-md);
    background-color: var(--color-gray-100);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--spacing-md);
}

pre code {
    padding: 0;
    background: none;
    color: inherit;
}

/* Blockquotes */
blockquote {
    margin: var(--spacing-lg) 0;
    padding-left: var(--spacing-lg);
    border-left: 4px solid var(--color-primary);
    color: var(--text-secondary);
    font-style: italic;
}

/* ============================================
 * LINKS
 * ============================================ */

a {
    color: var(--text-link);
    text-decoration: none;
    transition: var(--transition-colors);
    cursor: pointer;
}

a:hover {
    color: var(--text-link-hover);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

a:active {
    color: var(--color-primary-dark);
}

/* Remove underline from buttons styled as links */
button a {
    text-decoration: none;
}

/* ============================================
 * LISTS
 * ============================================ */

ol,
ul {
    list-style: none;
}

ol.styled,
ul.styled {
    padding-left: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
}

ul.styled {
    list-style-type: disc;
}

ol.styled {
    list-style-type: decimal;
}

ul.styled ul,
ol.styled ol {
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

li {
    margin-bottom: var(--spacing-xs);
}

/* ============================================
 * IMAGES AND MEDIA
 * ============================================ */

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    border-style: none;
}

svg {
    overflow: hidden;
    vertical-align: middle;
}

/* ============================================
 * FORMS
 * ============================================ */

/* Remove default button styles */
button {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
}

button,
input,
optgroup,
select,
textarea {
    font-family: inherit;
    font-size: 100%;
    line-height: 1.15;
    margin: 0;
}

/* Remove default field appearance */
input,
textarea,
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Remove spinner from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Remove search input styling */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
}

/* Standard input styles */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: var(--input-padding-y) var(--input-padding-x);
    border: var(--input-border-width) solid var(--input-border-color);
    border-radius: var(--input-border-radius);
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    transition: var(--transition-colors);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--input-focus-border-color);
    box-shadow: var(--input-focus-shadow);
}

/* Textarea specific */
textarea {
    resize: vertical;
    min-height: 100px;
}

/* Select specific */
select {
    cursor: pointer;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--spacing-md) center;
    background-size: 12px;
}

/* Checkbox and radio */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    margin-right: var(--spacing-sm);
    cursor: pointer;
}

/* File input */
input[type="file"] {
    width: 100%;
    cursor: pointer;
}

/* Disabled states */
input:disabled,
textarea:disabled,
select:disabled,
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Placeholder text */
::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

:-ms-input-placeholder {
    color: var(--text-muted);
}

::-ms-input-placeholder {
    color: var(--text-muted);
}

/* ============================================
 * TABLES
 * ============================================ */

table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    margin-bottom: var(--spacing-md);
}

th,
td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: var(--font-weight-semibold);
    background-color: var(--bg-secondary);
}

tr:hover {
    background-color: var(--bg-secondary);
}

/* ============================================
 * HORIZONTAL RULE
 * ============================================ */

hr {
    box-sizing: content-box;
    height: 0;
    overflow: visible;
    margin: var(--spacing-lg) 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

/* ============================================
 * HIDDEN ELEMENTS
 * ============================================ */

[hidden] {
    display: none !important;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
 * SELECTION
 * ============================================ */

::selection {
    background-color: var(--color-primary);
    color: var(--color-white);
}

::-moz-selection {
    background-color: var(--color-primary);
    color: var(--color-white);
}

/* ============================================
 * SCROLLBAR STYLES
 * ============================================ */

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--color-gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--color-gray-400);
    border-radius: var(--radius-full);
    border: 2px solid var(--color-gray-100);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-500);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-gray-400) var(--color-gray-100);
}

/* ============================================
 * FOCUS VISIBLE
 * Better keyboard navigation focus indicators
 * ============================================ */

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ============================================
 * PRINT STYLES
 * ============================================ */

@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }

    abbr[title]::after {
        content: " (" attr(title) ")";
    }

    a[href^="#"]::after,
    a[href^="javascript:"]::after {
        content: "";
    }

    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }

    thead {
        display: table-header-group;
    }

    tr,
    img {
        page-break-inside: avoid;
    }

    img {
        max-width: 100% !important;
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }

    /* Hide non-printable elements */
    nav,
    aside,
    .no-print {
        display: none !important;
    }
}

/* ============================================
 * RESPONSIVE UTILITIES
 * ============================================ */

/* Show/hide on different screen sizes */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .show-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .hide-tablet {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ============================================
 * LOADING STATE
 * ============================================ */

body.loading {
    overflow: hidden;
}

body.loading::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
 * NO JAVASCRIPT WARNING
 * ============================================ */

.no-js-warning {
    display: none;
    padding: var(--spacing-lg);
    background-color: var(--color-warning-light);
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    margin: var(--spacing-lg);
    text-align: center;
}

html.no-js .no-js-warning {
    display: block;
}

/* ============================================
 * CONTAINER
 * ============================================ */

.container {
    width: 100%;
    padding-right: var(--spacing-md);
    padding-left: var(--spacing-md);
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 576px) {
    .container {
        max-width: var(--container-sm);
    }
}

@media (min-width: 768px) {
    .container {
        max-width: var(--container-md);
    }
}

@media (min-width: 992px) {
    .container {
        max-width: var(--container-lg);
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: var(--container-xl);
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: var(--container-2xl);
    }
}

/* Fluid container */
.container-fluid {
    width: 100%;
    padding-right: var(--spacing-md);
    padding-left: var(--spacing-md);
    margin-right: auto;
    margin-left: auto;
}

/* Update the existing @media (max-width: 1200px) section with this: */

@media (max-width: 1200px) {
    .dimensions-grid {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    }

    /* Hide nav links and actions by default on mobile */
    .nav-links,
    .header-actions {
        display: none;
    }

    /* Show mobile menu when active */
    .nav-links.mobile-active {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #086586 0%, #0a7a9f 100%);
        padding: 24px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        z-index: 999;
        gap: 8px;
        animation: slideDown 0.3s ease;
    }

    .header-actions.mobile-active {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: calc(var(--header-height) + 180px);
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #064d63 0%, #086586 100%);
        padding: 24px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        z-index: 999;
        gap: 12px;
        animation: slideDown 0.3s ease;
    }

    /* Style mobile nav links */
    .nav-links.mobile-active .nav-link {
        width: 100%;
        padding: 12px 16px;
        border-radius: 8px;
        font-size: 16px;
        justify-content: flex-start;
    }

    /* Style mobile action buttons */
    .header-actions.mobile-active .header-btn {
        width: 100%;
        padding: 12px 16px;
        justify-content: center;
        font-size: 15px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    /* Animation for mobile menu */
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}