@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #0066B3;
    --primary-dark: #004C85;
    --primary-light: #3399FF;
    --primary-subtle: #e8f4fc;
    --surface: #ffffff;
    --background: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --info-bg: #eff6ff;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 14px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 4px 6px rgba(15, 23, 42, 0.04), 0 16px 32px rgba(15, 23, 42, 0.08);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-sm: 8px;
    --nav-height: 64px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --primary-blue: var(--primary);
    --primary-dark-blue: var(--primary-dark);
    --primary-light-blue: var(--primary-light);
    --text-color: var(--text);
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

body.auth-body {
    background: linear-gradient(145deg, #f8fafc 0%, #e8f4fc 45%, #dbeafe 100%);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* Navbar */
.app-navbar {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 0.5rem 0;
    min-height: var(--nav-height);
}

.app-navbar .navbar-brand img {
    height: 38px;
    width: auto;
}

.app-navbar .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.app-navbar .nav-link:hover {
    color: var(--primary) !important;
    background: var(--primary-subtle);
}

.app-navbar .nav-link.active {
    color: var(--primary) !important;
    background: var(--primary-subtle);
    font-weight: 600;
}

.app-navbar .dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
    margin-top: 0.35rem !important;
}

.app-navbar .dropdown-item {
    border-radius: 6px;
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
    color: var(--text-secondary) !important;
}

.app-navbar .dropdown-item:hover,
.app-navbar .dropdown-item:focus {
    background: var(--primary-subtle) !important;
    color: var(--primary) !important;
}

.app-navbar .dropdown-item i {
    width: 1.25rem;
    opacity: 0.7;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem !important;
    background: var(--border-light);
    border-radius: 999px !important;
}

.user-menu-toggle i {
    font-size: 1.25rem;
    color: var(--primary);
}

/* Main content */
.app-main {
    padding: 2rem 0 3rem;
    min-height: calc(100vh - var(--nav-height) - 60px);
}

.app-footer {
    padding: 1.25rem 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
}

/* Cards */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background: var(--surface);
    overflow: hidden;
}

.card-header {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-header h4,
.card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    color: #fff !important;
    border-bottom: none;
}

.card-header-primary h4,
.card-header-primary h5 {
    color: #fff;
}

.card-body {
    padding: 1.25rem;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.1rem;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 1px 2px rgba(0, 102, 179, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 179, 0.25);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-sm);
}

.btn-warning {
    background: var(--warning) !important;
    border-color: var(--warning) !important;
    color: #fff !important;
}

.btn-warning:hover {
    background: #b45309 !important;
    border-color: #b45309 !important;
    color: #fff !important;
}

/* Forms */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(0, 102, 179, 0.12);
}

.input-group-text {
    background: var(--border-light);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
}

.input-group .form-control {
    border-left: none;
}

.input-group .input-group-text.border-end-0 {
    border-right: none;
}

/* Auth pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-width: 440px;
    width: 100%;
    margin: 0 auto;
}

.auth-card-wide {
    max-width: 520px;
}

.auth-card .card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    color: #fff !important;
    border: none;
    padding: 2rem 1.5rem 1.5rem;
}

.auth-card .welcome-text {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.75rem 0 0.25rem;
    color: #fff;
}

.auth-card .subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    margin: 0;
}

.auth-card .company-logo {
    background: #fff !important;
    border-radius: var(--radius) !important;
    padding: 1rem !important;
    display: inline-block;
    box-shadow: var(--shadow);
}

.auth-card .company-logo img {
    max-height: 48px;
}

.auth-card .card-body {
    padding: 1.75rem;
    background: var(--surface);
}

.auth-card a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-card a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.status-working {
    background: var(--success-bg);
    color: var(--success);
}

.status-break {
    background: var(--warning-bg);
    color: var(--warning);
}

.status-inactive {
    background: var(--border-light);
    color: var(--text-muted);
}

/* Clock display */
#current-time {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    margin-bottom: 1.25rem;
    padding: 0.75rem;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    font-variant-numeric: tabular-nums;
}

/* List groups */
.list-group-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm) !important;
    margin-bottom: 0.5rem;
    padding: 1rem;
    transition: box-shadow 0.15s ease;
}

.list-group-item:hover {
    box-shadow: var(--shadow-sm);
}

.list-group-item:last-child {
    margin-bottom: 0;
}

/* Tables */
.table {
    font-size: 0.9rem;
}

.table thead th {
    background: var(--border-light);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    padding: 0.85rem 1rem;
}

.table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-color: var(--border-light);
}

.table-hover tbody tr:hover {
    background: var(--primary-subtle);
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
}

.alert-info {
    background: var(--info-bg);
    color: var(--primary-dark);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

.badge.bg-primary,
.bg-primary {
    background-color: var(--primary) !important;
}

.text-primary {
    color: var(--primary) !important;
}

/* Accordion (time entries) */
.accordion-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm) !important;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.accordion-button {
    font-weight: 500;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    box-shadow: none !important;
}

.accordion-button:not(.collapsed) {
    color: var(--primary);
    background: var(--primary-subtle);
}

.accordion-button:focus {
    box-shadow: none;
    border-color: var(--border);
}

/* Reset password tabs */
#resetMethodTabs .nav-link {
    color: var(--text-secondary) !important;
    background: var(--border-light);
    border: 1px solid var(--border);
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: var(--radius-sm) !important;
}

#resetMethodTabs .nav-link:hover {
    color: var(--primary) !important;
    background: var(--primary-subtle);
    border-color: rgba(0, 102, 179, 0.25);
}

#resetMethodTabs .nav-link.active,
#resetMethodTabs .nav-link.active:hover,
#resetMethodTabs .nav-link.active:focus {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

/* Schedule / calendar */
.calendar-cell {
    height: 120px;
    overflow-y: auto;
}

.calendar-cell:hover {
    background-color: var(--primary-subtle);
}

.schedule-item {
    font-size: 0.8rem;
    margin-bottom: 2px;
    padding: 4px 6px;
    border-radius: 4px;
    background: var(--primary);
    color: white;
    cursor: pointer;
}

.schedule-item:hover {
    background: var(--primary-dark);
}

.today {
    background-color: var(--primary-subtle);
}

/* Page header block */
.page-header {
    margin-bottom: 1.75rem;
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Stat cards for dashboard */
.stat-card {
    text-align: center;
    padding: 1.25rem;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.25rem;
}

.stat-card .stat-icon.blue {
    background: var(--primary-subtle);
    color: var(--primary);
}

/* Navbar toggler */
.navbar-toggler {
    border-color: var(--border);
    padding: 0.4rem 0.6rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(0, 102, 179, 0.15);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2815, 23, 42, 0.7%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

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

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

/* Pagination */
.pagination .page-link {
    border-radius: var(--radius-sm);
    margin: 0 2px;
    border-color: var(--border);
    color: var(--text-secondary);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* Location tree (time entries) */
#location-tree {
    padding: 1.25rem;
}

#location-tree .location-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Impersonation banner */
.impersonation-banner {
    background: #fff3cd;
    border-bottom: 1px solid #ffecb5;
    color: #664d03;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 991.98px) {
    .app-main {
        padding: 1.25rem 0 2rem;
    }

    .app-navbar .navbar-collapse {
        padding: 0.75rem 0;
    }

    .app-navbar .nav-link {
        padding: 0.6rem 0.75rem !important;
    }
}
