/* NORSU Alumni System - Base Styles */

/* CSS Custom Properties (Variables) */
:root {
    --primary-color: #2b3c6b;
    --primary-dark: #1a2544;
    --primary-light: #3c4f8a;
    --text-light: #f8f9fa;
    --font-primary: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --letter-spacing-tight: -0.025em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;
    --scrollbar-width: calc(100vw - 100%);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius-sm: 0.25rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Base Layout & Typography */
html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
    height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-right: 0 !important;
    background-color: #fff;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-tight);
    line-height: var(--line-height-tight);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: var(--border-radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Modal Fixes */
.modal-open {
    padding-right: 0 !important;
    overflow: hidden !important;
}

.modal {
    padding-right: 0 !important;
}

.modal-dialog {
    padding-right: var(--scrollbar-width);
}

/* Mobile Modal Fixes */
@media (max-width: 1199px) {
    .modal {
        padding: 0 !important;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .modal-dialog {
        margin: 1rem auto;
        max-width: calc(100% - 2rem);
        padding-right: 0;
    }

    .modal-dialog-scrollable {
        max-height: calc(100vh - 2rem);
    }

    .modal-content {
        max-height: calc(100vh - 2rem);
        overflow: visible;
    }

    .modal-body {
        max-height: calc(100vh - 250px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Ensure modal is centered and visible */
    .modal.show {
        display: block !important;
    }

    .modal.show .modal-dialog {
        transform: none !important;
        margin-top: 1rem;
    }

    /* Fix backdrop */
    .modal-backdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 10055 !important;
    }

    .modal-backdrop.show {
        opacity: 0.5 !important;
    }

    /* Ensure modal appears above backdrop */
    .modal {
        z-index: 10060 !important;
    }
}

/* Tablet and mobile specific adjustments */
@media (min-width: 768px) and (max-width: 1199px) {
    .modal-dialog {
        max-width: 85%;
        margin: 1.5rem auto;
    }

    .modal-dialog-lg {
        max-width: 80%;
    }

    .modal-body {
        max-height: calc(100vh - 200px);
    }
}

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem auto;
        max-width: calc(100% - 1rem);
    }

    .modal-dialog-scrollable {
        max-height: calc(100vh - 1rem);
    }

    .modal-content {
        max-height: calc(100vh - 1rem);
    }

    .modal-body {
        max-height: calc(100vh - 180px);
    }

    /* Prevent zoom on input focus (iOS) */
    .modal input,
    .modal select,
    .modal textarea {
        font-size: 16px !important;
    }
}

/* Specific fix for tablet landscape and small desktop (767-991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .modal-dialog {
        max-width: 90%;
        margin: 1.5rem auto;
    }

    .modal-dialog-lg {
        max-width: 85%;
    }

    .modal-body {
        max-height: calc(100vh - 200px);
    }
}

/* Main Content Layout */
main {
    flex: 1 0 auto;
    padding-top: 76px;
}

.content-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    padding: 0;
}

.content-wrapper.with-sidebar {
    margin-left: 250px;
    margin-top: 0 !important;
    padding: 0;
    width: calc(100% - 250px);
}

.main-content {
    width: 100%;
    margin: 0;
    padding: 0;
    background: white;
    min-height: calc(100vh - 76px);
}

/* Container Styles */
.form-container,
.page-container {
    max-width: 1400px;
    width: 98%;
    margin: 0.5rem auto;
    padding: 0;
}

/* Utility Classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn var(--transition-normal);
}

.fade-out {
    animation: fadeOut var(--transition-normal);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); }
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
