/* =====================================================
   STYLE.CSS - Marc Tracker
   Toate stilurile aplicației
   ===================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #0a0a0f;
    --card: #151520;
    --border: #252535;
    --text: #e8e8f0;
    --text-dim: #888899;
    --somn: #6366f1;
    --somn-glow: rgba(99, 102, 241, 0.3);
    --alaptare: #f472b6;
    --alaptare-glow: rgba(244, 114, 182, 0.3);
    --biberon: #34d399;
    --biberon-glow: rgba(52, 211, 153, 0.3);
}

body {
    font-family: 'Nunito', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* =====================================================
   LAYOUT
   ===================================================== */

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px 16px;
    padding-bottom: 100px;
}

header {
    text-align: center;
    margin-bottom: 24px;
    position: relative;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-logo {
    width: 32px;
    height: 32px;
}

.share-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    border-radius: 12px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.share-btn:hover {
    background: var(--border);
    border-color: var(--alaptare);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f472b6, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.menu-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 10px;
}

.menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-dim);
    border-radius: 2px;
}

.menu-btn:active {
    background: var(--card);
}

/* =====================================================
   STATUS BAR
   ===================================================== */

.status-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.status-card {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    text-align: center;
}

.status-card .label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.status-card .value {
    font-size: 1.1rem;
    font-weight: 700;
}

.weight-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

.weight-card:active {
    transform: scale(0.97);
}

/* =====================================================
   BUTTONS
   ===================================================== */

.buttons-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.btn {
    position: relative;
    border: none;
    border-radius: 24px;
    padding: 28px 24px;
    font-family: inherit;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

.btn-somn {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: white;
    box-shadow: 0 8px 32px var(--somn-glow);
}

.btn-somn.active {
    animation: pulse-active 2s infinite;
}

.btn-alaptare {
    background: linear-gradient(135deg, #db2777, #f472b6);
    color: white;
    box-shadow: 0 8px 32px var(--alaptare-glow);
}

.btn-alaptare.active {
    animation: pulse-active 2s infinite;
}

.btn-biberon {
    background: linear-gradient(135deg, #059669, #34d399);
    color: white;
    box-shadow: 0 8px 32px var(--biberon-glow);
}

@keyframes pulse-active {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 8px 32px rgba(0,0,0,0.2);
    }
    50% { 
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.6), 0 8px 32px rgba(0,0,0,0.2);
    }
}

.btn .icon {
    font-size: 2rem;
}

.btn .timer {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.15rem;
    font-weight: 700;
    color: white;
    font-variant-numeric: tabular-nums;
}

.btn .timer:empty {
    display: none;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
}

/* =====================================================
   MODALS
   ===================================================== */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px;
    width: 100%;
    max-width: 360px;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal h2 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--biberon);
}

.modal-cancel {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
}

.modal-save {
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: var(--biberon);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.modal-save:active {
    transform: scale(0.98);
}

/* =====================================================
   QUANTITY GRID (Biberon)
   ===================================================== */

.quantity-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.qty-btn {
    aspect-ratio: 1;
    border: 2px solid var(--border);
    border-radius: 16px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.qty-btn:hover, .qty-btn:focus {
    border-color: var(--biberon);
    background: rgba(52, 211, 153, 0.1);
}

.qty-btn:active {
    transform: scale(0.95);
    background: var(--biberon);
}

.custom-qty-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.custom-qty-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    text-align: center;
}

.custom-qty-input:focus {
    outline: none;
    border-color: var(--biberon);
}

.custom-qty-input::placeholder {
    color: #555;
}

.custom-qty-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    background: var(--biberon);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.custom-qty-btn:active {
    transform: scale(0.95);
}

.quantity-grid.small {
    gap: 8px;
    margin-top: 8px;
}

.quantity-grid.small .qty-btn {
    font-size: 0.9rem;
    border-radius: 10px;
}

/* =====================================================
   HISTORY
   ===================================================== */

.history-section {
    margin-top: 16px;
}

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

.history-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.date-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.date-display {
    position: relative;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 100px;
    text-align: center;
}

.date-picker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.day-summary {
    margin-top: 16px;
    padding: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: none;
}

.day-summary.show {
    display: block;
}

.day-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 4px 0;
}

.day-summary-row span:first-child {
    color: var(--text-dim);
}

.day-summary-row span:last-child {
    font-weight: 600;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
}

.history-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.history-icon.somn { background: rgba(99, 102, 241, 0.2); }
.history-icon.alaptare { background: rgba(244, 114, 182, 0.2); }
.history-icon.biberon { background: rgba(52, 211, 153, 0.2); }

.history-info {
    flex: 1;
    min-width: 0;
}

.history-type {
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: capitalize;
}

.history-time {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.history-detail {
    text-align: right;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.history-actions {
    display: flex;
    gap: 4px;
}

.history-delete {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    opacity: 0.5;
    font-size: 1.2rem;
}

.history-delete:hover {
    opacity: 1;
    color: #ef4444;
}

.history-edit {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    opacity: 0.5;
    font-size: 1rem;
}

.history-edit:hover {
    opacity: 1;
    color: var(--biberon);
}

/* =====================================================
   EDIT MODAL
   ===================================================== */

.modal-edit {
    max-width: 400px;
}

.edit-field {
    margin-bottom: 16px;
}

.edit-field label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.edit-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
}

.edit-input:focus {
    outline: none;
    border-color: var(--biberon);
}

.edit-qty-display {
    text-align: center;
    margin-top: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--biberon);
}

.edit-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.edit-buttons button {
    flex: 1;
}

/* =====================================================
   WEIGHT MODAL
   ===================================================== */

.modal-weight {
    max-width: 400px;
}

.weight-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.weight-tab {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.weight-tab.active {
    background: var(--biberon);
    border-color: var(--biberon);
    color: white;
}

.weight-tab-content {
    min-height: 150px;
}

.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
}

.weight-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.weight-input {
    flex: 1;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
}

.weight-input:focus {
    outline: none;
    border-color: var(--biberon);
}

.weight-unit {
    color: var(--text-dim);
    font-size: 1rem;
}

.weight-chart-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 20px;
}

.weight-avg {
    margin-top: 16px;
    padding: 14px;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 12px;
}

.weight-avg-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.weight-avg-row.dim {
    opacity: 0.6;
}

.weight-avg-row.comparison {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.weight-avg-row.comparison.positive .weight-avg-value {
    color: #34d399;
}

.weight-avg-row.comparison.negative .weight-avg-value {
    color: #f87171;
}

.weight-avg-label {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.weight-avg-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--biberon);
}

.weight-history-list {
    max-height: 250px;
    overflow-y: auto;
}

.weight-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.weight-history-item:last-child {
    border-bottom: none;
}

.weight-history-date {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.weight-history-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.weight-history-delete {
    padding: 6px 10px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1rem;
}

.weight-history-delete:hover {
    color: #ef4444;
}

/* =====================================================
   SETTINGS
   ===================================================== */

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: var(--bg);
    border-radius: 12px;
    cursor: pointer;
}

.settings-item:active {
    opacity: 0.8;
}

.settings-item-label {
    font-weight: 600;
}

.settings-item-value {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.settings-item-arrow {
    color: var(--text-dim);
}

.settings-item.logout-item .settings-item-label {
    color: #ef4444;
}

.invite-code {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-align: center;
    padding: 20px;
    background: var(--bg);
    border-radius: 12px;
    margin: 16px 0;
    color: var(--biberon);
}

.invite-info {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* =====================================================
   SETUP SCREEN
   ===================================================== */

.setup-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.setup-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    text-align: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px 24px;
}

.setup-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
}

.setup-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #f472b6, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.setup-subtitle {
    color: var(--text-dim);
    margin-bottom: 24px;
    font-size: 1rem;
    line-height: 1.5;
}

.setup-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setup-form {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
}

.setup-input {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 16px;
}

.setup-input:focus {
    outline: none;
    border-color: var(--biberon);
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 12px;
    margin-top: 8px;
}

.btn-link:hover {
    color: var(--text);
}

.setup-or {
    color: var(--text-dim);
    margin: 20px 0;
    font-size: 0.9rem;
}

.setup-invite-input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.setup-invite-input:focus {
    outline: none;
    border-color: var(--alaptare);
}

.setup-logout-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 6px 10px;
    color: #666;
}

.setup-logout-btn:active {
    background: rgba(255,255,255,0.1);
}

/* =====================================================
   LOGIN MODAL
   ===================================================== */

.login-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 8px;
}

.login-title {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #f472b6, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-dim);
    margin-bottom: 32px;
}

.login-form {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
}

.install-hint {
    display: block;
    margin-top: 24px;
    padding: 14px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.install-hint:hover {
    background: var(--border);
    border-color: var(--accent);
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1.1rem;
    text-align: center;
}

.input-group input:focus {
    outline: none;
    border-color: #6366f1;
}

.input-group input::placeholder {
    color: #555;
}

.message {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.message.success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #34d399;
}

.message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.code-inputs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

.code-inputs input {
    width: 45px;
    height: 55px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
}

.code-inputs input:focus {
    outline: none;
    border-color: #6366f1;
}

.timer {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.btn-link {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    margin-top: 12px;
}

/* =====================================================
   UTILITIES
   ===================================================== */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--card);
    border: 1px solid var(--border);
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 200;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Footer */
.footer {
    text-align: center;
    padding: 10px 16px 30px;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--text);
}

.footer-copy {
    opacity: 0.6;
}
