/* Mobile-First Responsive Design for Valoria Hotel Management System */

/* Global Mobile Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #dc3545 0%, #ffffff 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Container Fixes */
.container-fluid, .container {
    padding-left: 15px;
    padding-right: 15px;
    max-width: 100%;
    margin: 0 auto;
}

/* Card Responsive */
.card {
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    margin-bottom: 20px;
    border: none;
    overflow: hidden;
}

.card-body {
    padding: 20px;
}

/* Button Responsive */
.btn {
    min-height: 48px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 10px;
    width: 100%;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.98);
    transition: transform 0.1s;
}

/* Form Controls */
.form-control, .form-select {
    min-height: 48px;
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 12px 15px;
    margin-bottom: 15px;
    width: 100%;
}

.form-control:focus, .form-select:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    outline: none;
}

/* Input Labels */
.form-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
    font-size: 14px;
}

/* Navigation Mobile */
.navbar {
    padding: 10px 15px;
    background: rgba(220, 53, 69, 0.95) !important;
    backdrop-filter: blur(10px);
}

.navbar-brand {
    font-size: 1.4rem;
    font-weight: bold;
    color: white !important;
}

/* Guest Panel Mobile */
.guest-panel {
    padding: 15px;
    max-width: 100%;
}

.guest-panel .card {
    margin-bottom: 15px;
}

.guest-panel h1, .guest-panel h2 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 20px;
}

.guest-panel h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

/* Service Cards Mobile */
.service-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-left: 4px solid #dc3545;
}

.service-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
    text-align: center;
}

/* WiFi Info Mobile */
.wifi-info {
    background: linear-gradient(135deg, #7b68ee 0%, #9370db 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin: 15px 0;
}

.wifi-info h4 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.wifi-credentials {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
}

/* Chat Mobile */
.chat-container {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
}

.message.guest {
    background: #dc3545;
    color: white;
    margin-left: auto;
    margin-right: 0;
}

.message.manager {
    background: white;
    color: #333;
    margin-left: 0;
    margin-right: auto;
    border: 1px solid #e9ecef;
}

.chat-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e9ecef;
}

/* Complaint Form Mobile */
.complaint-form {
    padding: 20px;
}

.complaint-form textarea {
    min-height: 120px;
    resize: vertical;
}

/* Survey Mobile */
.survey-container {
    padding: 20px;
}

.rating-stars {
    display: flex;
    justify-content: center;
    margin: 15px 0;
    gap: 8px;
}

.star {
    font-size: 2rem;
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.star.active, .star:hover {
    color: #ffc107;
}

/* Manager Dashboard Mobile */
.dashboard-card {
    margin-bottom: 20px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #dc3545;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

/* Selfie Wall Mobile */
.selfie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 15px;
}

.selfie-item {
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.selfie-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Contract System Mobile */
.contract-container {
    padding: 15px;
    height: 100vh;
    overflow-y: auto;
}

.language-selection {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
}

.language-btn {
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
    background: white;
    text-align: center;
    transition: all 0.3s;
}

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

.contract-content {
    padding: 20px;
    background: white;
    border-radius: 15px;
    margin-bottom: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.contract-form {
    background: white;
    padding: 20px;
    border-radius: 15px;
    position: sticky;
    bottom: 0;
}

/* QR Print Mobile */
.qr-print-container {
    padding: 20px;
    text-align: center;
}

.qr-code-display {
    max-width: 250px;
    width: 100%;
    height: auto;
    margin: 20px auto;
    display: block;
}

/* Hotel Selection Mobile */
.hotel-selection {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 100vh;
    justify-content: center;
}

.hotel-option {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: transform 0.3s;
}

.hotel-option:active {
    transform: scale(0.98);
}

/* Responsive Images */
img {
    max-width: 100%;
    height: auto;
}

/* Toast Notifications Mobile */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    left: 20px;
    z-index: 1050;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* Loading States */
.loading {
    pointer-events: none;
    opacity: 0.7;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-radius: 50%;
    border-top: 2px solid #dc3545;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Safe Area for iPhone */
@supports (padding: max(0px)) {
    body {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
    
    .navbar {
        padding-top: max(10px, env(safe-area-inset-top));
    }
}

/* Landscape Mode Adjustments */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .chat-container {
        height: calc(100vh - 60px);
    }
    
    .contract-content {
        max-height: 40vh;
    }
    
    .guest-panel h1 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
}

/* Very Small Screens */
@media (max-width: 320px) {
    .container-fluid, .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .btn {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .form-control {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn, .card, .form-control {
        border-width: 0.5px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .card {
        background: #2d3748;
        color: white;
    }
    
    .form-control {
        background: #4a5568;
        border-color: #6b7280;
        color: white;
    }
    
    .message.manager {
        background: #4a5568;
        color: white;
        border-color: #6b7280;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Additional Mobile Fixes */
.display-3, .display-4 {
    font-size: 2rem !important;
}

@media (max-width: 768px) {
    .display-3, .display-4 {
        font-size: 1.75rem !important;
    }
    
    .hero-title {
        font-size: 1.5rem !important;
    }
    
    .hero-subtitle {
        font-size: 1rem !important;
    }
    
    .lead {
        font-size: 1rem !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.3rem !important;
    }
    
    h3 {
        font-size: 1.2rem !important;
    }
    
    h4 {
        font-size: 1.1rem !important;
    }
    
    h5 {
        font-size: 1rem !important;
    }
    
    /* Contract system mobile fixes */
    .contract-container .col-lg-8 {
        padding: 0 !important;
    }
    
    .contract-container .col-lg-4 {
        padding: 15px !important;
    }
    
    /* Guest panel language selection */
    .language-selection-top {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    .language-selection-top .btn {
        margin: 5px !important;
        font-size: 1rem !important;
        min-width: 120px !important;
    }
    
    /* WiFi card adjustments */
    .wifi-card {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    .wifi-card h4 {
        font-size: 1.1rem !important;
    }
    
    /* Service cards in guest panel */
    .service-cards .card {
        margin-bottom: 10px !important;
    }
    
    .service-cards .btn {
        font-size: 0.9rem !important;
        padding: 8px 12px !important;
    }
    
    /* Navigation adjustments */
    .navbar-brand img {
        height: 30px !important;
    }
    
    .navbar-nav .nav-link {
        font-size: 0.9rem !important;
        padding: 8px 12px !important;
    }
    
    /* Dashboard responsive */
    .dashboard-stats {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    .stat-card {
        padding: 15px !important;
    }
    
    .stat-number {
        font-size: 1.5rem !important;
    }
    
    /* Form improvements */
    .form-control, .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Table responsive */
    .table-responsive {
        border: none !important;
    }
    
    table {
        font-size: 0.9rem !important;
    }
    
    table th, table td {
        padding: 8px 4px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 150px !important;
    }
    
    /* Chat mobile specific */
    .chat-messages {
        padding: 10px !important;
    }
    
    .message {
        margin-bottom: 10px !important;
        max-width: 90% !important;
    }
    
    .chat-input-container {
        padding: 10px !important;
    }
    
    .chat-input-container textarea {
        min-height: 44px !important;
    }
    
    /* Complaint form mobile */
    .complaint-form textarea {
        min-height: 100px !important;
    }
    
    /* Manager dashboard mobile */
    .manager-nav .nav-pills .nav-link {
        font-size: 0.85rem !important;
        padding: 8px 10px !important;
        margin: 2px !important;
    }
}

/* Very small screens adjustments */
@media (max-width: 480px) {
    .container, .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    .card-body {
        padding: 15px !important;
    }
    
    .btn {
        font-size: 14px !important;
        padding: 10px 15px !important;
    }
    
    .language-selection-top .btn {
        font-size: 0.9rem !important;
        min-width: 100px !important;
    }
    
    .wifi-card .row .col-md-6 {
        margin-bottom: 10px !important;
    }
    
    table th, table td {
        max-width: 100px !important;
        font-size: 0.8rem !important;
    }
}

/* Landscape phone adjustments */
@media screen and (orientation: landscape) and (max-height: 500px) and (max-width: 900px) {
    .hero-section {
        min-height: 100vh !important;
    }
    
    .navbar {
        padding: 5px 15px !important;
    }
    
    .guest-panel h1, .guest-panel h2 {
        font-size: 1.2rem !important;
        margin-bottom: 10px !important;
    }
    
    .language-selection-top {
        padding: 10px !important;
    }
    
    .wifi-card {
        padding: 10px !important;
    }
}

/* Print Styles */
@media print {
    body {
        background: white !important;
    }
    
    .btn, .navbar, .chat-input-container {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}