/* Global Styles - Mobile First */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --text-color: #333;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.15);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    color: var(--text-color);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Login Page Styles - Mobile First */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding: 16px;
    padding-top: calc(16px + var(--safe-top));
    padding-bottom: calc(16px + var(--safe-bottom));
}

.login-box {
    background: white;
    padding: 24px 20px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    text-align: center;
    margin-bottom: 24px;
}

.logo i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.logo h1 {
    color: var(--secondary-color);
    font-size: 22px;
    margin-bottom: 4px;
}

.logo p {
    color: #7f8c8d;
    font-size: 13px;
}

/* Form Styles - Mobile First */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--secondary-color);
    font-weight: 500;
    font-size: 14px;
}

.form-group label i {
    margin-right: 5px;
    color: var(--primary-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px; /* Prevents zoom on iOS */
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
}

/* Button Styles - Mobile First */
.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    min-height: 48px; /* Touch-friendly */
    touch-action: manipulation;
}

.btn i {
    font-size: 16px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
}

.btn-primary:hover,
.btn-primary:active {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover,
.btn-secondary:active {
    background: #7f8c8d;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover,
.btn-success:active {
    background: #229954;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover,
.btn-danger:active {
    background: #c0392b;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover,
.btn-warning:active {
    background: #d68910;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-sm {
    padding: 10px 16px;
    font-size: 13px;
    min-height: 40px;
}

.btn-logout {
    background: var(--danger-color);
    color: white;
    width: 100%;
}

.btn-logout:hover,
.btn-logout:active {
    background: #c0392b;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer p {
    color: #7f8c8d;
    font-size: 14px;
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Notification Styles - Mobile First */
.notification {
    position: fixed;
    top: calc(16px + var(--safe-top));
    left: 16px;
    right: 16px;
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    display: none;
    animation: slideInDown 0.3s ease-out;
    font-size: 14px;
    font-weight: 500;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification.show {
    display: block;
}

.notification.success {
    background: var(--success-color);
    color: white;
}

.notification.error {
    background: var(--danger-color);
    color: white;
}

.notification.info {
    background: var(--info-color);
    color: white;
}

.notification.warning {
    background: var(--warning-color);
    color: white;
}

/* Modal Styles - Mobile First */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.2s ease-out;
    padding: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.show {
    display: flex;
    align-items: flex-end; /* Slide from bottom on mobile */
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
    box-shadow: var(--shadow-lg);
    -webkit-overflow-scrolling: touch;
}

.modal-large {
    max-height: 95vh;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--light-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-radius: 20px 20px 0 0;
}

.modal-header h2 {
    color: var(--secondary-color);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header i {
    color: var(--primary-color);
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 4px 8px;
    line-height: 1;
}

.close:hover,
.close:active {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
    padding-bottom: calc(20px + var(--safe-bottom));
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-direction: column;
}

.modal-actions .btn {
    width: 100%;
}

/* Form Row - Mobile First (stacked) */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }

/* ======================================
   TABLET & DESKTOP RESPONSIVE (min-width)
   Mobile-First: styles above are for mobile,
   these media queries enhance for larger screens
   ====================================== */

/* Tablet (768px and up) */
@media (min-width: 768px) {
    .login-box {
        padding: 40px;
    }
    
    .logo i {
        font-size: 60px;
    }
    
    .logo h1 {
        font-size: 28px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 14px;
        padding: 12px 15px;
    }
    
    .form-row {
        flex-direction: row;
    }
    
    .form-row .form-group {
        flex: 1;
    }
    
    .modal.show {
        align-items: center;
        padding: 20px;
    }
    
    .modal-content {
        border-radius: 16px;
        max-width: 600px;
    }
    
    .modal-large {
        max-width: 900px;
    }
    
    .modal-header {
        padding: 20px 30px;
        border-radius: 16px 16px 0 0;
    }
    
    .modal-header h2 {
        font-size: 22px;
    }
    
    .modal-body {
        padding: 30px;
    }
    
    .modal-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .modal-actions .btn {
        width: auto;
    }
    
    .notification {
        left: auto;
        right: 20px;
        max-width: 400px;
    }
}

/* Desktop (1024px and up) */
@media (min-width: 1024px) {
    .btn:hover {
        transform: translateY(-2px);
    }
}
