/* ===== RESET MOBILE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.4;
    background: linear-gradient(to bottom, #e8ecef 0%, #d5dde0 100%);
    color: #2c3e50;
    padding: 0;
    margin: 0;
    min-height: 100vh;
}

/* ===== LAYOUT PRINCIPAL ===== */
.container {
    width: 100%;
    padding: 15px 10px;
    max-width: 100%;
}

/* ===== HEADER MOBILE ===== */
header {
    background: linear-gradient(135deg, #1a2f4f 0%, #1e3c72 100%);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-bottom: 3px solid #f39c12;
}

.mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.nav-brand {
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    flex: 1;
}

/* Menu Mobile */
.mobile-nav {
    display: none;
    background: linear-gradient(135deg, #1a2f4f 0%, #1e3c72 100%);
    padding: 0 15px 15px;
}

.mobile-nav.active {
    display: block;
}

.mobile-nav ul {
    list-style: none;
}

.mobile-nav li {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.mobile-nav li:last-child {
    border-bottom: none;
}

.mobile-nav a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 15px 10px;
    font-size: 1rem;
    transition: background 0.3s;
}

.mobile-nav a:hover {
    background: rgba(255,255,255,0.1);
}

.user-info-mobile {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    margin-top: 10px;
    border-radius: 8px;
    text-align: center;
}

/* ===== BOTÕES MOBILE ===== */
.btn {
    display: inline-block;
    padding: 16px 20px;
    background: #1e3c72;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    width: 100%;
    margin: 5px 0;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    box-shadow: 0 4px 8px rgba(30, 60, 114, 0.3);
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1a2f4f 0%, #1e3c72 100%);
    box-shadow: 0 6px 12px rgba(30, 60, 114, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: #28a745;
}

.btn-danger {
    background: #dc3545;
}

.btn-small {
    padding: 12px 15px;
    font-size: 0.9rem;
    width: auto;
    min-width: 80px;
}

/* ===== DASHBOARD MOBILE ===== */
.dashboard-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    text-align: center;
    border-left: 4px solid #1e3c72;
    transition: all 0.3s ease;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: bold;
    color: #1e3c72;
    margin: 10px 0;
    display: block;
}

.quick-actions {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin: 20px 0;
    border-left: 4px solid #1e3c72;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ===== TABELAS MOBILE ===== */
.mobile-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin: 15px 0;
    border: 1px solid #d5dde0;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}

.table-scroll th {
    background: linear-gradient(135deg, #1a2f4f 0%, #1e3c72 100%);
    color: white;
    padding: 15px 10px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #f39c12;
}

.table-scroll td {
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

/* ===== FORMS MOBILE ===== */
.form-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin: 15px 0;
    border-left: 4px solid #1e3c72;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px; /* Prevent zoom on iOS */
    background: #fafbfc;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #1e3c72;
    outline: none;
    background: white;
}

.form-group textarea {
    height: 120px;
    resize: vertical;
    font-family: inherit;
}

/* ===== COMPONENTES DINÂMICOS ===== */
.dynamic-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #1e3c72;
}

.action-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
    padding: 0 10px;
}

/* ===== DETALHES MOBILE ===== */
.detail-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin: 15px 0;
    border-left: 4px solid #1e3c72;
}

.detail-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.detail-section h3 {
    color: #1a2f4f;
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-left: 4px solid #f39c12;
    padding-left: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== FOTOS MOBILE ===== */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.photo-item {
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
}

.photo-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.photo-item small {
    display: block;
    padding: 8px 5px;
    background: white;
    font-size: 0.8rem;
    color: #666;
}

/* ===== MENSAGENS ===== */
.alert {
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    font-weight: 500;
}

.alert-error {
    background: #fee;
    color: #c33;
    border-left: 4px solid #c33;
}

.alert-success {
    background: #efe;
    color: #363;
    border-left: 4px solid #363;
}

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-recebida {
    background: #ffe6e6;
    color: #dc3545;
}

.status-em_andamento {
    background: #fff3cd;
    color: #856404;
}

.status-concluída {
    background: #e6f4ea;
    color: #28a745;
}

/* ===== MEDIA QUERIES ===== */

/* Tablets (768px+) */
@media (min-width: 768px) {
    html {
        font-size: 15px;
    }
    
    .container {
        padding: 20px;
        max-width: 95%;
    }
    
    .dashboard-stats {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .stat-card {
        flex: 1;
        min-width: 200px;
    }
    
    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .btn {
        width: auto;
        min-width: 150px;
    }
    
    .action-bar {
        flex-direction: row;
    }
    
    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .mobile-header {
        display: none;
    }
    
    .mobile-nav {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 0 20px;
        height: 70px;
    }
    
    .mobile-nav ul {
        display: flex;
        gap: 5px;
    }
    
    .mobile-nav li {
        border-bottom: none;
    }
    
    .mobile-nav a {
        padding: 12px 15px;
        border-radius: 6px;
    }
    
    .user-info-mobile {
        margin-top: 0;
        padding: 8px 15px;
        min-width: 200px;
    }
    
    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Telas muito pequenas (360px-) */
@media (max-width: 360px) {
    html {
        font-size: 13px;
    }
    
    .container {
        padding: 10px 8px;
    }
    
    .form-card,
    .detail-card,
    .stat-card {
        padding: 15px;
    }
    
    .photo-grid {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 14px 16px;
    }
}

/* Orientação paisagem em mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-nav {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        overflow-y: auto;
    }
}

/* Melhorias para touch */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
    }
    
    .form-group input,
    .form-group select {
        min-height: 44px;
    }
    
    .mobile-nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #fff;
    }
    
    .form-card,
    .detail-card,
    .stat-card,
    .quick-actions {
        background: #2d2d2d;
        color: #fff;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        background: #3d3d3d;
        border-color: #555;
        color: #fff;
    }
}

        .login-bg {
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        
        .login-card {
            background: white;
            border-radius: 20px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
            overflow: hidden;
            max-width: 450px;
            width: 100%;
        }
        
        .login-header {
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
            color: white;
            padding: 40px 20px;
            text-align: center;
            position: relative;
            overflow: hidden;
        }
        
        .login-header::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            animation: pulse 3s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { transform: scale(1); opacity: 0.5; }
            50% { transform: scale(1.1); opacity: 0.8; }
        }
        
        .login-logo-container {
            position: relative;
            z-index: 1;
            margin-bottom: 20px;
        }
        
        .login-logo {
            max-width: 120px;
            width: auto;
            height: auto;
            filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
            animation: logoFloat 3s ease-in-out infinite;
        }
        
        @keyframes logoFloat {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
        }
        
        .login-header i {
            font-size: 3rem;
            margin-bottom: 15px;
            display: block;
        }
        
        .login-header h1 {
            font-size: 1.8rem;
            margin: 0;
            font-weight: 600;
            position: relative;
            z-index: 1;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }
        
        .login-header p {
            margin: 10px 0 0;
            opacity: 0.95;
            font-size: 0.9rem;
            position: relative;
            z-index: 1;
        }
        
        .login-body {
            padding: 30px;
        }
        
        .input-group-icon {
            position: relative;
        }
        
        .input-group-icon .form-control {
            padding-left: 45px;
            height: 50px;
            border-radius: 10px;
            border: 2px solid #e1e5e9;
            font-size: 16px;
        }
        
        .input-group-icon .bi {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #666;
            font-size: 1.2rem;
            z-index: 10;
        }
        
        .login-help {
            text-align: center;
            margin-top: 20px;
            color: #666;
            font-size: 0.9rem;
        }
        
        .login-help a {
            color: #1e3c72;
            text-decoration: none;
            font-weight: 500;
        }
        
        .login-help a:hover {
            text-decoration: underline;
        }
        
        /* Avatar do usuário no header */
        .user-avatar {
            max-width: 70px;
            max-height: 70px;
            width: auto;
            height: auto;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid rgba(255, 255, 255, 0.3);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }
        
        @media (max-width: 768px) {
            .user-avatar {
                max-width: 50px;
                max-height: 50px;
            }
        }