@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
    /* Color Palette - Professional BNI Red/White/Deep Slate */
    --primary: #cf142b;
    /* Crisp BNI Red */
    --primary-light: #e6223b;
    --primary-dark: #a80e21;
    --secondary: #1a1e23;
    /* Very deep corporate slate, almost black */

    --background: #f8fafc;
    /* Crisp light gray background */
    --surface: #ffffff;
    --surface-hover: #f1f5f9;

    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --success: #059669;
    --success-bg: #d1fae5;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --info: #2563eb;
    --info-bg: #dbeafe;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-card: 0 12px 24px -10px rgba(0, 0, 0, 0.05);

    /* Professional, sharper corners */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius-full: 9999px;

    --font-heading: 'Montserrat', sans-serif;
    --font-sans: 'Inter', sans-serif;

    --transition: all 0.2s ease-in-out;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--secondary);
    letter-spacing: -0.015em;
    line-height: 1.3;
}

/* Utility */
.margin-bottom-none {
    margin-bottom: 0 !important;
}

.margin-bottom-sm {
    margin-bottom: 0.25rem;
}

.margin-bottom-m {
    margin-bottom: 0.75rem;
}

.margin-bottom-l {
    margin-bottom: 1.25rem;
}

.margin-bottom-xl {
    margin-bottom: 1.75rem;
}

.text-nowrap {
    white-space: nowrap;
}

.mb-0 {
    margin-bottom: 0 !important;
}

/* Responsive Utilities */
.grid-responsive {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 1.5rem;
}

.flex-responsive {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.flex-responsive > * {
    flex: 1;
    min-width: min(100%, 200px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    gap: 0.5rem;
    background-color: var(--surface);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 6px -1px rgba(207, 20, 43, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 6px 12px -2px rgba(207, 20, 43, 0.3);
    transform: translateY(-1px);
    color: white;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-warning:hover {
    background-color: #b45309;
}

.btn-outline {
    background-color: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: #fffafa;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
    color: var(--text-muted);
}

.form-control {
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background-color: #f8fafc;
    color: var(--text-main);
}

.form-control:hover {
    border-color: #cbd5e1;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--surface);
    box-shadow: 0 0 0 3px rgba(207, 20, 43, 0.1);
}

/* Layout */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.navbar-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.navbar-brand {
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    color: var(--secondary);
    letter-spacing: -0.02em;
}

.brand-text {
    color: var(--primary);
}

.navbar-nav {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    padding: 0.5rem 0;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

.nav-link.highlight {
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
}

.nav-link.highlight:hover {
    background: var(--primary);
    color: white;
}

.main-content {
    max-width: 100%;
    margin: 1.5rem auto;
    padding: 0 2rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
}

.dashboard-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    color: var(--secondary);
}

.dashboard-header p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 600px;
}

/* Cards & Tables */
.card,
.stat-card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1.5rem;
    position: relative;
    border-top: 4px solid var(--border);
}

.stat-card:hover {
    border-top-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card-title {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-family: var(--font-heading);
    font-size: 2.75rem;
    font-weight: 700;
    color: var(--secondary);
    line-height: 1;
}

.table-container {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow-x: auto;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background-color: var(--surface);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

.table tbody tr {
    transition: background-color 0.2s;
}

.table tbody tr:hover {
    background-color: var(--surface-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table td {
    color: var(--text-main);
    font-size: 0.95rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.badge-secondary {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-danger {
    background-color: var(--danger-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
    border-left: 4px solid var(--danger);
}

.alert-success {
    background-color: var(--success-bg);
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-left: 4px solid var(--success);
}

.alert-info {
    background-color: var(--info-bg);
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-left: 4px solid var(--info);
}

/* Login */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc;
    background-image:
        radial-gradient(circle at top right, rgba(207, 20, 43, 0.03), transparent 30%),
        radial-gradient(circle at bottom left, rgba(30, 41, 59, 0.03), transparent 30%);
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 0 1.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-title {
    font-size: 2.5rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.login-title span {
    color: var(--primary);
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 500;
}

.login-card {
    background: var(--surface);
    padding: 3.5rem 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    border-top: 5px solid var(--primary);
}

/* Clock In */
.public-clockin-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 2rem;
    background-color: var(--surface);
    background-image: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.clockin-card {
    background: var(--surface);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-lg);
    border-top: 6px solid var(--primary);
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.clockin-header {
    padding: 3rem 2.5rem 1.5rem;
    text-align: center;
    background: #fcfcfd;
    border-bottom: 1px solid var(--border);
}

.clockin-header h1 {
    margin-bottom: 0.5rem;
    color: var(--secondary);
    font-size: 1.85rem;
    font-weight: 800;
}

.clockin-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.clockin-body {
    padding: 1.5rem 2.5rem;
}

#memberSelect {
    height: 52px;
    font-size: 1.05rem;
    background-color: #f8fafc;
}

/* Scan Result Overrides inside Clock In */
.scan-result-card {
    text-align: center;
    padding: 1.5rem 0.5rem;
}

.scan-success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    border: 4px solid white;
    box-shadow: var(--shadow-sm);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 90%;
    max-width: 460px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger);
    transform: scale(1.1);
}

.qr-container {
    display: flex;
    justify-content: center;
    padding: 2.5rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .navbar-container,
    .main-content {
        padding: 0 1.5rem;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        height: 64px;
        padding: 0 1rem;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }

    .navbar-toggler {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 28px;
        height: 24px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 4px;
        z-index: 110;
        transition: var(--transition);
    }

    .navbar-toggler span {
        width: 100%;
        height: 2px;
        background-color: var(--secondary);
        border-radius: 2px;
        transition: var(--transition);
        transform-origin: center;
    }

    .navbar-toggler.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .navbar-toggler.open span:nth-child(2) { opacity: 0; }
    .navbar-toggler.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .navbar-menu {
        position: fixed;
        top: 0;
        right: -100%;
        bottom: 0;
        width: 280px;
        background: var(--surface);
        padding: 80px 1.5rem 1.5rem;
        box-shadow: -10px 0 30px rgba(0,0,0,0.1);
        display: block;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 105;
        border-left: 1px solid var(--border);
    }

    .navbar-menu.active {
        right: 0;
    }

    .navbar-nav {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        border-radius: var(--radius);
        width: 100%;
    }

    .nav-link.active::after {
        display: none;
    }

    .nav-link.active {
        background: rgba(207, 20, 43, 0.05);
        color: var(--primary);
    }

    .nav-link.highlight {
        margin-top: 1rem;
        text-align: center;
    }

    .main-content {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    .dashboard-header .btn {
        width: 100%;
        justify-content: center;
    }

    .stat-cards {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .stat-card-value {
        font-size: 2.25rem;
    }

    .table-container {
        position: relative;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 2.5rem 1.5rem;
    }

    .login-title {
        font-size: 2rem;
    }

    .clockin-header {
        padding: 2.5rem 1.5rem 1rem;
    }

    .clockin-body {
        padding: 1rem 1.5rem;
    }
    
    .modal-content {
        padding: 1.5rem;
    }
}

/* Animation Utilities */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.4s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Animation Utilities */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.4s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}