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

:root {
    --primary: #1e293b;   /* Slate 800 - Sidebar */
    --accent: #3b82f6;    /* Blue 500 - Buttons */
    --accent-hover: #2563eb;
    --bg-app: #f8fafc;    /* Slate 50 - Background */
    --bg-card: #ffffff;
    --text-main: #0f172a; /* Slate 900 */
    --text-sub: #64748b;  /* Slate 500 */
    --border-color: #e2e8f0;
    --red: #ef4444;
    --green: #22c55e;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    transition: width 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.logo-icon {
    color: var(--accent);
}

.nav-menu {
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-item:hover, .nav-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background-color: var(--accent);
}

.section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #475569;
    margin: 1.5rem 0 0.75rem 1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.hidden {
    display: none !important;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    margin-top: 1rem;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: #94a3b8;
}

#btn-logout {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
}

#btn-logout:hover {
    background: rgba(255, 0, 0, 0.2);
    color: var(--red);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.welcome h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: var(--shadow);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-badge.online .status-dot { background-color: var(--green); }
.status-badge.offline .status-dot { background-color: var(--red); }

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.blue { background-color: rgba(59, 130, 246, 0.1); color: var(--accent); }
.stat-icon.red { background-color: rgba(239, 68, 68, 0.1); color: var(--red); }
.stat-icon.green { background-color: rgba(34, 197, 94, 0.1); color: var(--green); }

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-info p {
    font-size: 0.875rem;
    color: var(--text-sub);
}

/* Tasks Table */
.content-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.section-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.25rem;
}

.task-table {
    width: 100%;
    border-collapse: collapse;
}

.task-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    color: var(--text-sub);
    font-size: 0.875rem;
    font-weight: 600;
}

.task-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.task-row:hover {
    background-color: #f8fafc;
}

.status-indicator {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-synced { color: var(--green); }
.status-local { color: var(--accent); }

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
}

.btn-primary:hover { background-color: var(--accent-hover); }

.btn-secondary {
    background-color: #f1f5f9;
    color: #475569;
}

.btn-secondary:hover { background-color: #e2e8f0; }

.full-width { width: 100%; justify-content: center; }

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

.auth-container {
    max-width: 400px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--accent);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.auth-toggle {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-sub);
}

.auth-toggle a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.main-content > * {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Page Visibility */
.page-section.hidden {
    display: none !important;
}

/* Calendar View */
.calendar-grid {
    padding: 1.5rem;
}

.calendar-day-section {
    margin-bottom: 2rem;
}

.date-header {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-sub);
    text-transform: uppercase;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.daily-tasks {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-card.mini {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.task-card.mini.completed {
    background: #f1f5f9;
    opacity: 0.7;
}

.task-card.mini.completed .task-title {
    text-decoration: line-through;
}

.task-time {
    font-weight: 700;
    color: var(--accent);
    min-width: 60px;
}

.task-title {
    font-weight: 600;
}

.empty-state {
    text-align: center;
    color: var(--text-sub);
    padding: 3rem;
    font-style: italic;
}

/* Token Generation UI */
.token-generation-container {
    padding: 3rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.section-description {
    color: var(--text-sub);
    max-width: 400px;
    line-height: 1.6;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 12px;
}

.code-display {
    background: #f1f5f9;
    padding: 2rem;
    border-radius: 16px;
    border: 2px dashed var(--accent);
    width: 100%;
    max-width: 400px;
    animation: fadeIn 0.5s ease-out;
}

.code-display h1 {
    font-size: 2.5rem;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin: 1rem 0;
    font-family: monospace;
}

.copy-hint {
    font-size: 0.875rem;
    color: var(--green);
    font-weight: 600;
}
