@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #003399;
    /* TT Blue */
    --primary-hover: #002266;
    --bg-gradient: linear-gradient(135deg, #f0f4f8 0%, #e1e7ed 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(0, 51, 153, 0.1);
    --text-main: #1a1a1a;
    --text-muted: #64748b;
    --success: #66cc33;
    /* TT Green */
    --pending: #eab308;
    --danger: #ef4444;
}

body {
    min-height: 100vh;
    background: var(--bg-gradient);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    box-shadow: 0 4px 12px 0 rgba(0, 51, 153, 0.08);
}

input,
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #ffffff;
    /* White background */
    border: 1px solid #94a3b8;
    /* Visible border */
    border-radius: 0.5rem;
    color: #0f172a;
    /* Dark text */
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
}

input::placeholder,
textarea::placeholder {
    color: #64748b;
    /* Visible placeholder */
    opacity: 1;
}

input:focus,
textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Dashboard Layout */
.dashboard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    position: relative;
    /* Create stacking context */
    z-index: 50;
    /* Ensure nav stays above grid content */
}


.user-menu-container {
    position: relative;
    z-index: 1000;
    /* High z-index to show on top */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.user-info:hover {
    background: rgba(0, 51, 153, 0.05);
}

.user-details {
    text-align: right;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid var(--card-border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    display: none;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.user-dropdown.show {
    display: flex;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.875rem;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f1f5f9;
}

.dropdown-item.danger {
    color: var(--danger);
    border-top: 1px solid #f1f5f9;
}

.dropdown-item.danger:hover {
    background: #fef2f2;
}

.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.role-admin {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.role-tl {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

/* Grid Layouts */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 968px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.section-title {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Table Design */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--card-border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.875rem;
}

.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pending {
    background: rgba(234, 179, 8, 0.1);
    color: #fde047;
}

.status-completed {
    background: rgba(34, 197, 94, 0.1);
    color: #86efac;
}

.status-planned {
    background: rgba(0, 51, 153, 0.1);
    color: #003399;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Loading Spinner */
.loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

/* Admin Stats Layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    /* font-size: 1.5rem; // svg size handles it */
}

.icon-total {
    background: rgba(0, 51, 153, 0.1);
    color: var(--primary-color);
}

.icon-pending {
    background: rgba(234, 179, 8, 0.1);
    color: var(--pending);
}

.icon-completed {
    background: rgba(102, 204, 51, 0.1);
    color: var(--success);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

/* TL Breakdown Section */
.tl-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.tl-breakdown-item {
    padding: 1.25rem;
    border-left: 4px solid var(--primary-color);
    background: rgba(0, 51, 153, 0.03);
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.tl-breakdown-item:hover {
    background: rgba(0, 51, 153, 0.08);
    transform: translateX(5px);
}

.tl-breakdown-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tl-breakdown-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
}

.tl-stat-item {
    display: flex;
    flex-direction: column;
}

.tl-stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.tl-stat-value {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
}

/* Modal sizing fix */
.modal {
    max-width: 500px;
    width: 90%;
    padding: 2rem;
}

#app {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    min-height: 100vh;
}

/* Glassmorphism Classes */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Spechy Style Login Layout */
#loginView {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    background: #f8fafc;
    overflow: hidden;
}

.login-left {
    flex: 1.5;
    position: relative;
    background: #001a4d url('favicon.png') no-repeat center center;
    background-size: cover;
    /* This makes it fill the whole area */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Integrated-logo removed from here as it will be removed from HTML */

.login-left::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 26, 77, 0.3);
    /* Darker overlay for better contrast */
}

.login-right {
    flex: 1;
    /* 40% space */
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.08);
    z-index: 10;
}

.login-logo {
    max-width: 240px;
    /* Slightly larger logo */
    margin-bottom: 2.5rem;
    display: block;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    background: transparent;
    padding: 0;
    box-shadow: none;
    text-align: left;
}

.auth-container h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-align: left;
    background: none;
    -webkit-text-fill-color: initial;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    font-size: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
    display: block;
}

.form-group input {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    border-radius: 0.5rem;
}

.form-group input:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 51, 153, 0.1);
}

#loginForm .btn {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Pagination Controls */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Responsive Fix */
@media (max-width: 1024px) {
    .login-left {
        display: none;
    }

    .login-right {
        flex: 1;
    }
}
