/* ============================================================================
   GUTTAS JULERIBBE TRACKER - FELLES STILER
   ============================================================================ */

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Fargevariabler */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #475569;
    --emerald: #10b981;
    --cyan: #06b6d4;
    --blue: #3b82f6;
    --purple: #a855f7;
    --red: #ef4444;
    --amber: #f59e0b;
    --orange: #f97316;
}

/* Base */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0c1222 50%, var(--bg-primary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Ambient bakgrunn */
.ambient-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    width: 100%;
    max-width: 100vw;
}

.ambient-bg::before {
    content: '';
    position: absolute;
    top: -20%;
    left: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.ambient-bg::after {
    content: '';
    position: absolute;
    bottom: -20%;
    right: 10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.08) 0%, transparent 70%);
    border-radius: 50%;
}

@media (max-width: 768px) {
    .ambient-bg::before {
        width: 300px;
        height: 300px;
        left: 0%;
    }

    .ambient-bg::after {
        width: 300px;
        height: 300px;
        right: 0%;
    }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
}

/* Header */
header {
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
    backdrop-filter: blur(12px);
    background: rgba(15, 23, 42, 0.5);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--emerald), var(--cyan));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-text h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--emerald), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Bruker-seksjon */
.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
    flex-shrink: 0;
}

.user-details {
    display: none;
}

@media (min-width: 640px) {
    .user-details {
        display: flex;
        flex-direction: column;
    }
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.logout-btn {
    margin-left: 0.5rem;
}

/* Knapper */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--emerald), var(--cyan));
    color: white;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.35);
}

.btn-google {
    background: white;
    color: #1f2937;
    padding: 0.625rem 1.5rem;
}

.btn-google:hover {
    background: #f3f4f6;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
}

.btn-ghost:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

/* Main content */
main {
    padding: 2rem 0;
}

/* Card */
.card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 20px;
    padding: 1.5rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 767px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 20px;
    padding: 1.5rem;
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.emerald {
    background: rgba(16, 185, 129, 0.2);
    color: var(--emerald);
}

.stat-icon.cyan {
    background: rgba(6, 182, 212, 0.2);
    color: var(--cyan);
}

.stat-icon.purple {
    background: rgba(168, 85, 247, 0.2);
    color: var(--purple);
}

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.2);
    color: var(--amber);
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.2);
    color: var(--blue);
}

.stat-icon.red {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value span {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Chart section */
.chart-section {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: rgba(51, 65, 85, 0.5);
    border-radius: 8px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chart-container {
    height: 400px;
    position: relative;
}

@media (max-width: 767px) {
    .chart-section {
        padding: 1rem 0.5rem;
    }
    .chart-container {
        height: 300px;
    }
}

/* Entries section */
.entries-section {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 20px;
    padding: 1.5rem;
}

.entries-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.entries-empty svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.entries-empty h3 {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.entries-empty p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.entries-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.entry-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(71, 85, 105, 0.2);
    border-radius: 16px;
    transition: all 0.2s ease;
    overflow: hidden;
}

@media (max-width: 480px) {
    .entry-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .entry-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .confirm-delete {
        flex-direction: column;
        gap: 0.5rem;
    }

    .confirm-delete .btn {
        width: 100%;
        max-width: none;
    }
}

.entry-item:hover {
    border-color: rgba(71, 85, 105, 0.5);
}

.entry-item.confirming {
    position: relative;
}

.entry-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.entry-weight-badge {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.entry-details h4 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.entry-details p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.entry-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.delete-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.entry-item:hover .delete-btn {
    opacity: 1;
}

.confirm-delete {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    border-radius: 16px;
}

.confirm-delete .btn {
    flex: 1;
    max-width: 120px;
}



/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.125rem;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.user-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
}

.user-preview .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.user-preview .name {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.user-preview .date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.modal-actions .btn {
    flex: 1;
    padding: 0.875rem;
}

/* Date picker */
.custom-date-picker {
    position: relative;
}

.date-display {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
}

.date-display:hover {
    border-color: var(--emerald);
}

.date-display:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.date-display svg {
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.date-display:hover svg {
    color: var(--emerald);
}

.date-picker-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.date-picker-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.date-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.current-month {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    text-transform: capitalize;
}

.date-nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-nav-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--emerald);
    color: var(--emerald);
}

.date-picker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 0.5rem;
}

.date-picker-weekdays span {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.5rem 0;
    text-transform: uppercase;
}

.date-picker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.date-picker-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.date-picker-day:hover:not(.other-month):not(.selected) {
    background: var(--bg-tertiary);
}

.date-picker-day.other-month {
    color: var(--text-muted);
    opacity: 0.4;
}

.date-picker-day.today:not(.selected) {
    border: 1px solid var(--emerald);
    color: var(--emerald);
}

.date-picker-day.selected {
    background: linear-gradient(135deg, var(--emerald), var(--cyan));
    color: white;
    font-weight: 600;
}

.date-picker-day.selected:hover {
    background: linear-gradient(135deg, var(--emerald), var(--cyan));
}

/* Footer */
footer {
    border-top: 1px solid rgba(71, 85, 105, 0.3);
    padding: 1.5rem 0;
    margin-top: 2rem;
    text-align: center;
}

footer p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(16, 185, 129, 0.2);
    border-top-color: var(--emerald);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 1rem;
}

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    text-align: center;
    max-width: 400px;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.login-logo .logo-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
}

.login-logo .logo-icon svg {
    width: 48px;
    height: 48px;
}

.login-logo h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--emerald), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.login-card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 24px;
    padding: 2rem;
}

.login-card h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.login-card .btn-google {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-divider span {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
