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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, rgba(34, 87, 50, 0.95) 0%, rgba(76, 110, 72, 0.95) 100%),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800"><rect fill="%23225732" width="1200" height="800"/><g fill-opacity="0.1"><circle fill="%23ffffff" cx="100" cy="100" r="50"/><circle fill="%23ffffff" cx="900" cy="200" r="40"/><circle fill="%23ffffff" cx="300" cy="600" r="45"/><circle fill="%23ffffff" cx="1000" cy="650" r="35"/></g></svg>');
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

.screen {
    display: block;
}

.screen.hidden {
    display: none;
}

.card {
    background: #ffffff;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.2);
    margin: 20px 0;
    border: 2px solid rgba(139, 115, 85, 0.2);
}

h1 {
    color: #ffffff;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.8em;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.4);
    font-weight: 700;
    letter-spacing: 1px;
}

h2 {
    color: #2d5016;
    margin-bottom: 20px;
    border-bottom: 3px solid #6b8e23;
    padding-bottom: 10px;
    font-weight: 600;
}

input, select {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #d4d4c8;
    border-radius: 8px;
    font-size: 1em;
    background: #fafaf8;
    transition: all 0.3s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: #6b8e23;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(107, 142, 35, 0.1);
}

button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #6b8e23 0%, #556b2f 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(107, 142, 35, 0.3);
}

button:hover {
    background: linear-gradient(135deg, #556b2f 0%, #3d4f1f 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 142, 35, 0.4);
}

button:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #8b7355 0%, #6b5940 100%);
    box-shadow: 0 4px 15px rgba(139, 115, 85, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #6b5940 0%, #4a3d2a 100%);
    box-shadow: 0 6px 20px rgba(139, 115, 85, 0.4);
}

.logout-btn {
    width: auto;
    padding: 10px 20px;
    background: linear-gradient(135deg, #8b4513 0%, #654321 100%);
    margin: 0;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.3);
}

.logout-btn:hover {
    background: linear-gradient(135deg, #654321 0%, #4a2f15 100%);
    box-shadow: 0 6px 20px rgba(139, 69, 19, 0.4);
}

.admin-btn {
    width: auto;
    padding: 10px 20px;
    background: linear-gradient(135deg, #2d5016 0%, #1f3810 100%);
    margin: 0;
    box-shadow: 0 4px 15px rgba(45, 80, 22, 0.3);
}

.admin-btn:hover {
    background: linear-gradient(135deg, #1f3810 0%, #142408 100%);
    box-shadow: 0 6px 20px rgba(45, 80, 22, 0.4);
}

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

.add-item-form {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.add-item-form button {
    margin-top: 0;
}

.item {
    background: #f8f6f2;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    border: 1px solid #d4d4c8;
    border-left: 4px solid #6b8e23;
}

.item-delete {
    background: linear-gradient(135deg, #8b4513 0%, #654321 100%);
    width: auto;
    padding: 8px 15px;
    margin: 0;
    font-size: 0.9em;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.3);
}

.item-delete:hover {
    background: linear-gradient(135deg, #654321 0%, #4a2f15 100%);
}

.total {
    text-align: right;
    font-size: 1.5em;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 3px solid #6b8e23;
    color: #2d5016;
    font-weight: 700;
}

.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: linear-gradient(135deg, #6b8e23 0%, #556b2f 100%);
    color: white;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    display: none;
    z-index: 1000;
    font-weight: 600;
    border: 2px solid rgba(255,255,255,0.3);
}

.message.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { 
        transform: translateX(400px);
        opacity: 0;
    }
    to { 
        transform: translateX(0);
        opacity: 1;
    }
}

a {
    color: #6b8e23;
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    text-decoration: underline;
    color: #556b2f;
}

p {
    text-align: center;
    margin-top: 15px;
    color: #4a5568;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .add-item-form {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .header h1 {
        font-size: 1.8em;
        margin-bottom: 0;
    }
    
    .logout-btn {
        width: 100%;
    }
}

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

.modal-content {
    background-color: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    border: 2px solid rgba(139, 115, 85, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 3px solid #6b8e23;
    background: linear-gradient(135deg, #f8f6f2 0%, #ffffff 100%);
    border-radius: 14px 14px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: #2d5016;
    border: none;
    padding: 0;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    color: #8b7355;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #2d5016;
}

.modal-body {
    padding: 30px;
}

.modal-body label {
    display: block;
    margin-bottom: 5px;
    color: #4a5568;
    font-weight: 500;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid #d4d4c8;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #fafaf8;
    border-radius: 0 0 14px 14px;
}

/* Admin Tab Styles */
.admin-tab {
    padding: 12px 20px;
    background: #f8f6f2;
    color: #2d5016;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.admin-tab:hover {
    background: #e8e6e2;
    transform: translateY(-2px);
}

.admin-tab.active-tab {
    background: linear-gradient(135deg, #6b8e23 0%, #556b2f 100%);
    color: white;
    border-color: #556b2f;
    box-shadow: 0 4px 12px rgba(107, 142, 35, 0.3);
}

.admin-tab-content {
    animation: fadeIn 0.3s ease-in;
}

.admin-tab-content.hidden {
    display: none;
}

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

.modal-footer button {
    width: auto;
    padding: 10px 20px;
    margin: 0;
}


/* ========== MOBILE UX IMPROVEMENTS ========== */

/* Minimum tap target sizes (44x44px per Apple HIG) */
button, .admin-tab, select {
    min-height: 48px;
}

/* Prevent iOS zoom on input focus (font-size >= 16px) */
input, select, textarea {
    font-size: 16px !important;
}

/* Better field labels */
.field-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2d5016;
    font-size: 0.95em;
}

/* Readonly field display */
.readonly-field {
    background: #f8f6f2;
    padding: 14px;
    border-radius: 8px;
    border: 2px solid #d4d4c8;
    color: #2d5016;
    font-weight: 600;
    font-size: 1.1em;
}

/* Helper text */
.helper-text {
    margin-top: 15px;
    font-size: 0.9em;
    color: #8b7355;
    text-align: center;
}

/* Login mascot */
.login-mascot {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    border: 4px solid #ffffff;
}

/* Subtitle */
.subtitle {
    text-align: center;
    color: #ffffff;
    font-size: 1.2em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-weight: 500;
}

/* Button sizing */
.btn-large {
    min-height: 52px !important;
    font-size: 16px !important;
    padding: 14px !important;
}

/* Link-style button */
.btn-link {
    background: none;
    border: none;
    color: #667eea;
    text-decoration: underline;
    cursor: pointer;
    font-size: 15px;
    padding: 10px;
    min-height: 44px;
}
.btn-link:hover {
    color: #5a67d8;
    background: none;
    transform: none;
    box-shadow: none;
}

/* Admin tabs bar */
.admin-tabs-bar {
    background: white;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 20px;
}
.stat-card {
    padding: 20px;
    border-radius: 8px;
}
.stat-green { background: #f0fff4; border-left: 4px solid #48bb78; }
.stat-orange { background: #fffaf0; border-left: 4px solid #ed8936; }
.stat-blue { background: #ebf8ff; border-left: 4px solid #4299e1; }
.stat-gray { background: #f7fafc; border-left: 4px solid #718096; }
.stat-number { font-size: 2em; font-weight: bold; }
.stat-green .stat-number { color: #48bb78; }
.stat-orange .stat-number { color: #ed8936; }
.stat-blue .stat-number { color: #4299e1; }
.stat-gray .stat-number { color: #718096; }
.stat-label { color: #6b5940; }

/* Quick actions grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.quick-actions-grid button {
    min-height: 52px;
}

/* Base rent box */
.base-rent-box {
    background: #f0fff4;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #48bb78;
}

/* Better message notification - centered */
#message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
    display: none;
    max-width: 90%;
    text-align: center;
}
#message.show {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Mobile responsive improvements */
@media (max-width: 768px) {
    .admin-tab {
        padding: 10px 12px;
        font-size: 0.9em;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    /* Ensure modals are scrollable */
    .modal {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .stat-card {
        padding: 15px;
    }
    .stat-number {
        font-size: 1.5em;
    }
}
