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

:root {
    --primary-color: #6366f1;
    --secondary-color: #ec4899;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark: #1f2937;
    --gray: #6b7280;
    --light-gray: #f3f4f6;
    --white: #ffffff;
    --border-radius: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--light-gray);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Loading screen */
.loading-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-screen.show {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--light-gray);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Pages */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* App pages (wewnętrzne strony aplikacji) */
.app-page {
    display: none;
}

.app-page.active {
    display: block;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

/* Auth page */
.auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo i {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.logo h1 {
    font-size: 32px;
    color: var(--dark);
    font-weight: 700;
}

.auth-form {
    display: none;
    background: var(--white);
    padding: 32px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    margin-bottom: 24px;
    color: var(--dark);
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--gray);
    font-size: 14px;
    font-weight: 500;
}

.form-group label i {
    margin-right: 6px;
    width: 16px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--light-gray);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    color: var(--gray);
    font-size: 14px;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    font-family: inherit;
    width: 100%;
}

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

.btn-primary:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--dark);
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    width: auto;
}

.btn-icon {
    padding: 8px 12px;
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--gray);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: var(--light-gray);
    color: var(--primary-color);
}

/* Header */
.app-header {
    background: var(--white);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 24px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-header i {
    color: var(--primary-color);
}

/* Container */
.container {
    padding: 20px;
    padding-bottom: 100px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card h3 {
    margin-bottom: 16px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h3 {
    margin-bottom: 0;
}

/* Summary cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--white);
    flex-shrink: 0;
}

.card-content {
    flex: 1;
}

.card-label {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.card-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

/* Chart */
.chart-card canvas {
    max-height: 300px;
}

/* Goals list */
.goals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.goal-item {
    padding: 16px;
    background: var(--light-gray);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.goal-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
}

.goal-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.goal-type.weight {
    background: #dbeafe;
    color: #1e40af;
}

.goal-progress {
    margin-top: 12px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

.progress-text {
    font-size: 14px;
    color: var(--gray);
}

/* Weight history */
.weight-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.weight-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--light-gray);
    border-radius: 8px;
}

.weight-date {
    font-size: 14px;
    color: var(--gray);
}

.weight-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
}

.weight-change {
    font-size: 14px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.weight-change.positive {
    color: var(--success-color);
    background: #d1fae5;
}

.weight-change.negative {
    color: var(--danger-color);
    background: #fee2e2;
}

/* Bottom navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    color: var(--gray);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.3s;
    flex: 1;
}

.nav-item i {
    font-size: 20px;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--light-gray);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.3s;
}

.close-modal:hover {
    background: var(--light-gray);
}

.modal form {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions .btn {
    flex: 1;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }

    .card-value {
        font-size: 20px;
    }

    .modal-content {
        max-height: 95vh;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.hidden {
    display: none !important;
}
