/**
 * common.css
 * ------------------------------------------------------------
 * Global stylesheet shared across the application.
 *
 * Contains:
 * - Theme color variables
 * - Global reset and typography
 * - Layout and responsive spacing
 * - Card component styling
 * - Form controls and input groups
 * - Button styling
 * - Footer and status layout
 * - Alert notification container
 * - Validation states
 * - Custom scrollbar styling
 * - Modal styling
 *
 * This file provides the common UI styling.
 * ------------------------------------------------------------
 */

/* Theme color palette and reusable design tokens */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --border: #dbe3ec;
    --surface: #ffffff;
    --background: #f4f7fb;
    --text: #1f2937;
    --muted: #6b7280;
    --shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
    --radius: 18px;
    --transition: 0.3s ease;
}

/* Global element reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* DM Sans - Variable font (normal style) */
@font-face {
    font-family: "DM Sans";
    src: url("../../fonts/DMSans-VariableFont_opsz,wght.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
}

/* DM Sans - Variable font (italic style) */
@font-face {
    font-family: "DM Sans";
    src: url("../../fonts/DMSans-Italic-VariableFont_opsz,wght.ttf") format("truetype");
    font-weight: 100 900;
    font-style: italic;
}

/* Apply DM Sans as the default font across form controls and page content */
body,
button,
input,
textarea {
    font-family: 'DM Sans', sans-serif;
}

/* Base page styling */
body {
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
}

/* Responsive container spacing for tablets and mobile devices */
@media (max-width: 768px) {
    .container {
        padding-left: 18px;
        padding-right: 18px;
    }
}

/* Primary page heading */
h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

/* Responsive heading size */
@media (max-width: 768px) {
    h2 {
        font-size: 1.6rem;
    }
}

/* Secondary helper text */
.text-muted {
    font-size: 0.95rem;
}

/* Card component */
.card {
    border: none;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

/* Card hover animation */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

/* Card header layout */
.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.2rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #edf2f7;
    font-size: 1rem;
    font-weight: 600;
}

/* Card header icon */
.card-header i {
    font-size: 1.15rem;
    color: var(--primary);
}

/* Card content area */
.card-body {
    padding: 1.5rem;
}

/* Responsive card body spacing */
@media (max-width: 768px) {
    .card-body {
        padding: 1.25rem;
    }
}

/* Form field labels */
.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
    color: #475569;
}

/* Standard text inputs and select controls */
.form-control,
.form-select {
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.95rem;
    transition: var(--transition);
    box-shadow: none;
}

/* Multi-line text area */
textarea.form-control {
    height: auto;
    min-height: 220px;
    padding-top: 0.9rem;
    resize: vertical;
}

/* Focus state for form controls */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: none;
    outline: none;
}

/* Highlight input group when any child control receives focus */
.input-group:focus-within {
    border-radius: 12px;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

/* Apply focus border color to all input group elements */
.input-group:focus-within .input-group-text,
.input-group:focus-within .form-control,
.input-group:focus-within .form-select,
.input-group:focus-within .btn {
    border-color: var(--primary);
}

/* Highlight input group icon on focus */
.input-group:focus-within .input-group-text {
    background: #eff6ff;
    color: var(--primary);
}

/* Input group icon container */
.input-group-text {
    width: 48px;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 12px 0 0 12px;
    color: #64748b;
}

/* Remove duplicate border between icon and input */
.input-group .form-control {
    border-left: none;
}

/* Right-side button inside input groups */
.input-group .btn {
    border-radius: 0 12px 12px 0;
    border-color: var(--border);
}

/* Base button transition */
.btn {
    transition: var(--transition);
}

/* Primary action button */
.btn-primary {
    background: var(--primary);
    border: none;
    border-radius: 12px;
    font-weight: 600;
    padding: 0.8rem 1.6rem;
}

/* Primary button hover effect */
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Disabled primary button */
.btn-primary:disabled {
    opacity: 0.8;
    transform: none;
}

/* Secondary outline button */
.btn-outline-secondary {
    background: #fff;
}

/* Footer action bar */
.footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
}

/* Responsive footer layout */
@media (max-width: 768px) {
    .footer-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .footer-bar .btn {
        width: 100%;
    }
}

/* Status indicator section */
.status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

/* Center status section on smaller screens */
@media (max-width: 768px) {
    .status {
        justify-content: center;
    }
}

/* Status badge */
.badge {
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Floating alert notification container */
#alertContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 360px;
    max-width: calc(100vw - 30px);
    z-index: 9999;
}

/* Responsive alert container */
@media (max-width: 768px) {
    #alertContainer {
        left: 15px;
        right: 15px;
        width: auto;
    }
}

/* Alert appearance */
.alert {
    border: none;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

/* Loading spinner */
.spinner-border {
    width: 1rem;
    height: 1rem;
}

/* Invalid form field styling */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger);
    background-image: none;
    box-shadow: none;
}

/* Highlight invalid input groups */
.input-group:has(.form-control.is-invalid),
.input-group:has(.form-select.is-invalid) {
    border-radius: 12px;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

/* Apply invalid border color to input group elements */
.input-group:has(.form-control.is-invalid) .input-group-text,
.input-group:has(.form-select.is-invalid) .input-group-text,
.input-group:has(.form-control.is-invalid) .form-control,
.input-group:has(.form-select.is-invalid) .form-select,
.input-group:has(.form-control.is-invalid) .btn,
.input-group:has(.form-select.is-invalid) .btn {
    border-color: var(--danger);
}

/* Invalid input group icon styling */
.input-group:has(.form-control.is-invalid) .input-group-text,
.input-group:has(.form-select.is-invalid) .input-group-text {
    background: #fef2f2;
    color: var(--danger);
}

/* Remove duplicate border between input and appended button */
.input-group .btn {
    border-left: none;
}

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

/* Scrollbar thumb */
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 20px;
}

/* Scrollbar thumb hover state */
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Modal dialog */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Modal header */
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #edf2f7;
}

/* Modal title */
.modal-title {
    font-size: 1.05rem;
    font-weight: 600;
}

/* Modal body */
.modal-body {
    padding: 2rem;
}

/* Responsive modal spacing */
@media (max-width:576px) {
    .modal-body {
        padding: 1.5rem;
    }
}