/* Mobile-First Responsive CSS - iPhone 13 Pro Optimized */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; 
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white; 
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden; /* No horizontal scroll */
}

/* Container - Full width mobile */
.container { 
    max-width: 100%; 
    margin: 0 auto; 
    padding: 15px; 
}

/* Typography - Mobile optimized */
h1 { font-size: clamp(24px, 5vw, 32px); text-align: center; margin-bottom: 25px; }
h2 { font-size: clamp(20px, 4.5vw, 26px); }
h3 { font-size: clamp(18px, 4vw, 22px); }

/* Buttons - Touch friendly (44px min height iOS) */
.btn, .new-project-btn, .save-btn { 
    padding: 16px 24px; 
    border: none; 
    border-radius: 12px; 
    font-size: clamp(16px, 4vw, 18px); 
    font-weight: 600;
    cursor: pointer; 
    min-height: 44px; /* iOS touch target */
    display: flex; 
    align-items: center; 
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.new-project-btn, .save-btn { width: 100%; margin: 10px 0; }
.btn:hover { transform: scale(1.02); }

/* Cards - Mobile grid */
.projects-grid, .item-list, .expense-list { 
    display: grid; 
    grid-template-columns: 1fr; /* Single column mobile */
    gap: 15px; 
    margin: 20px 0;
}

.project-card, .item-card, .expense-card { 
    background: rgba(30, 41, 59, 0.9); 
    padding: 25px; 
    border-radius: 16px; 
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.1);
}

.project-card:active { transform: scale(0.98); } /* Touch feedback */

/* Forms - Mobile optimized */
input, select, textarea { 
    width: 100%; 
    padding: 18px; 
    margin: 12px 0; 
    border: 2px solid #475569; 
    border-radius: 12px; 
    background: rgba(15, 23, 42, 0.9); 
    color: white; 
    font-size: clamp(16px, 4.5vw, 18px);
    min-height: 50px;
}

input:focus, select:focus, textarea:focus {
    border-color: #22c55e;
    outline: none;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* Modal - Fullscreen mobile */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    background: rgba(0,0,0,0.95); 
    z-index: 1000; 
    padding: 20px;
}

.modal-content { 
    background: linear-gradient(135deg, #020617 0%, #1e293b 100%); 
    margin: 20px auto; 
    padding: 30px; 
    border-radius: 20px; 
    width: 100%; 
    max-height: calc(100vh - 40px); 
    overflow-y: auto; 
    position: relative; 
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.close { 
    position: absolute; 
    right: 20px; 
    top: 20px; 
    font-size: 36px; 
    cursor: pointer; 
    color: #94a3b8; 
    z-index: 1001;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* No projects message */
.no-projects { 
    text-align: center; 
    padding: 60px 20px; 
    color: #94a3b8; 
    font-size: clamp(18px, 5vw, 22px); 
}

/* Tablet & Desktop */
@media (min-width: 768px) {
    .container { padding: 20px 40px; max-width: 1200px; }
    .projects-grid, .item-list, .expense-list { 
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); 
    }
    .new-project-btn, .save-btn { width: auto; }
    .modal-content { margin: 5% auto; width: 90%; max-width: 1100px; }
}

@media (min-width: 390px) and (max-width: 844px) and (-webkit-min-device-pixel-ratio: 3) {
    /* iPhone 13 Pro specific */
    body { font-size: 17px; }
    .project-card { padding: 28px; }
}

/* Landscape */
@media (orientation: landscape) and (max-height: 500px) {
    .modal-content { margin: 10px auto; padding: 20px; }
    input, select, textarea { padding: 14px; }
}
