/* ============================================
   ENHANCED GLOBAL STYLES - UI/UX POLISH
   ============================================ */

/* Root Variables (Toastmasters Brand) */
:root {
    /* Toastmasters core palette */
    --tm-navy: #004165;
    --tm-burgundy: #772432;
    --tm-gold: #F2DF74;
    --tm-gray-100: #f5f7f9;
    --tm-gray-200: #e8edf1;
    --tm-gray-600: #667788;
    --tm-gray-800: #2b3a46;

    /* Map to existing tokens to minimize template churn */
    --primary-dark: var(--tm-navy);
    --primary-light: #2a5f84; /* lighter navy for gradients */
    --accent-color: var(--tm-gold);
    --secondary-accent: var(--tm-burgundy);
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-bg: var(--tm-gray-100);
    --card-bg: #ffffff;
    --text-primary: var(--tm-gray-800);
    --text-secondary: #4b5c69;
    --text-muted: #8aa0b2;
    --border-color: var(--tm-gray-200);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   TYPOGRAPHY ENHANCEMENTS
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
    color: var(--primary-dark);
    transition: color var(--transition-base);
}

p {
    line-height: 1.6;
    color: var(--text-secondary);
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: all var(--transition-base);
}

a:hover {
    color: var(--secondary-accent);
}

/* Hero tagline contrast fix */
.hero .hero-content > p {
    color: #f2df74;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

/* ============================================
   BUTTON ENHANCEMENTS
   ============================================ */

.btn, button {
    font-family: inherit;
    border: none;
    border-radius: 6px;
    padding: 0.9rem 1.8rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width var(--transition-base), height var(--transition-base);
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--light-bg);
    color: var(--primary-dark);
    border: 2px solid var(--primary-dark);
}

.btn-secondary:hover {
    background: var(--primary-light);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

/* ============================================
   CARD ENHANCEMENTS
   ============================================ */

.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    border: 1px solid var(--border-color);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

/* ============================================
   INPUT ENHANCEMENTS
   ============================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="month"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    transition: all var(--transition-base);
    background: var(--card-bg);
    color: var(--text-primary);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(42, 82, 152, 0.1);
    background: var(--card-bg);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* ============================================
   FORM GROUP ENHANCEMENTS
   ============================================ */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: color var(--transition-base);
}

.form-group input:focus + label,
.form-group textarea:focus + label {
    color: var(--primary-light);
}

/* ============================================
   BADGE ENHANCEMENTS
   ============================================ */

.badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all var(--transition-base);
}

.badge-primary {
    background: rgba(0, 65, 101, 0.08);
    color: var(--primary-dark);
}

.badge-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(242, 223, 116, 0.2);
    color: #8a6d00;
}

.badge-danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   TABLE ENHANCEMENTS
   ============================================ */

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

tbody tr {
    transition: all var(--transition-base);
}

tbody tr:hover {
    background: var(--light-bg);
    box-shadow: inset 0 0 0 1px var(--primary-light);
}

/* ============================================
   ALERT ENHANCEMENTS
   ============================================ */

.alert {
    padding: 1.2rem 1.5rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    animation: slideDown var(--transition-base) ease-out;
    border-left: 4px solid;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: #155724;
    border-left-color: var(--success-color);
}

.alert-error,
.alert-danger {
    background: rgba(220, 53, 69, 0.1);
    color: #721c24;
    border-left-color: var(--danger-color);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
    border-left-color: var(--warning-color);
}

.alert-info {
    background: rgba(102, 126, 234, 0.1);
    color: #0c5460;
    border-left-color: var(--accent-color);
}

/* ============================================
   GRID ENHANCEMENTS
   ============================================ */

.grid, .grid-2, .grid-3 {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (max-width: 768px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   SCROLLBAR ENHANCEMENTS
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
    border-radius: 10px;
    transition: background var(--transition-base);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-color) 100%);
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-bg);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   TRANSITIONS & ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in {
    animation: fadeIn var(--transition-base);
}

.slide-up {
    animation: slideUp var(--transition-base);
}

.scale-in {
    animation: scaleIn var(--transition-base);
}

/* ============================================
   FOCUS VISIBLE FOR ACCESSIBILITY
   ============================================ */

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* ============================================
   MODAL ENHANCEMENTS
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn var(--transition-base);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    animation: scaleIn var(--transition-base);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-base);
    padding: 0;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ============================================
   SKELETON LOADER
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, var(--light-bg) 25%, rgba(0, 0, 0, 0.05) 50%, var(--light-bg) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    height: 20px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-primary {
    color: var(--primary-dark) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.m-1 { margin: 0.5rem; }
.m-2 { margin: 1rem; }
.m-3 { margin: 1.5rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex {
    display: flex;
    align-items: center;
}

.d-flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.d-grid {
    display: grid;
}

.rounded {
    border-radius: 6px;
}

.rounded-lg {
    border-radius: 12px;
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   RESPONSIVE ENHANCEMENTS
   ============================================ */

@media (max-width: 768px) {
    h1, h2 {
        font-size: 1.5rem;
    }

    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.95rem;
    }

    .card {
        padding: 1rem;
    }

    table {
        font-size: 0.9rem;
    }

    th, td {
        padding: 0.75rem;
    }
}

/* ============================================
   DARK MODE SUPPORT - DISABLED
   ============================================ */

/*
   Dark mode media query removed to prevent automatic
   background color changes across all pages based on
   system preferences. Re-enable when manual toggle is implemented.
*/

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: more) {
    .btn-primary {
        border: 2px solid white;
    }

    .card {
        border-width: 2px;
    }

    table th {
        border-bottom: 3px solid white;
    }
}

/* ============================================
   PREMIUM ALERTS & MODALS (Unified System)
   ============================================ */

/* Premium Alert Styling */
.alert {
    padding: 1.25rem 1.75rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideInFade 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: none;
    border-left: 6px solid;
    background: white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, currentColor, transparent 15%);
    opacity: 0.08;
    pointer-events: none;
}

.alert i {
    font-size: 1.4rem;
}

.alert-success {
    border-left-color: #10b981;
    color: #065f46;
}

.alert-success i { color: #10b981; }

.alert-error, .alert-danger {
    border-left-color: #ef4444;
    color: #991b1b;
}

.alert-error i, .alert-danger i { color: #ef4444; }

@keyframes slideInFade {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Premium Modal Styling */
.modal-overlay {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.modal-content.premium-modal {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-icon {
    width: 64px;
    height: 64px;
    background: #fee2e2;
    color: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
}

.modal-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.modal-desc {
    color: #64748b;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-modal-cancel {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    background: white;
    border: 1px solid #e2e8f0;
    color: #64748b;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-modal-cancel:hover {
    background: #f8fafc;
    color: #334155;
    border-color: #cbd5e1;
}

.btn-modal-confirm {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    background: #ef4444;
    color: white;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
    transition: all 0.2s;
    cursor: pointer;
}

.btn-modal-confirm:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(239, 68, 68, 0.4);
}
