/**
 * PWA Mobile Styles
 * Touch-optimized responsive design for Guesthouse Booking
 */

/**
 * Color Overrides - Siyah yerine Koyu Gri
 */

/* Genel text renkleri */
body,
.wrap h1,
.egb-admin-section h2,
.egb-admin-section h3,
.form-table th,
input,
textarea,
select,
button,
.button {
    color: #2c3e50 !important;  /* Koyu gri - siyah yerine */
}

/* Başlıklar */
h1, h2, h3, h4, h5, h6 {
    color: #34495e !important;
}

/* Placeholder metinler */
::placeholder {
    color: #7f8c8d !important;
    opacity: 1;
}

/* Input borders */
input,
textarea,
select {
    border-color: #95a5a6 !important;
}

/* Dark mode - daha da açık */
@media (prefers-color-scheme: dark) {
    body,
    .egb-admin-section,
    input,
    textarea,
    select {
        color: #ecf0f1 !important;
        background: #2c3e50 !important;
    }
    
    .wp-list-table tr {
        background: #34495e !important;
        color: #ecf0f1 !important;
    }
}

/* Kontrast iyileştirme */
.egb-pwa-install-text h3,
.egb-pwa-install-text p {
    color: #2c3e50 !important;
}

/* Button text */
.button-primary {
    color: white !important;  /* Primary butonlar beyaz kalacak */
}

/* Status badges - daha okunur */
.egb-status-badge {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Table text */
.wp-list-table td {
    color: #34495e !important;
}

.wp-list-table td::before {
    color: #7f8c8d !important;  /* Label metinleri daha açık */
}


/* ==========================================================================
   1. Base Mobile Styles
   ========================================================================== */

@media (max-width: 782px) {
    
    /* Body Anpassungen */
    body.wp-admin {
        padding-top: 46px !important;
    }
    
    /* WordPress Admin Bar auf Mobile */
    #wpadminbar {
        position: fixed !important;
    }
    
    /* Haupt-Container */
    .wrap {
        margin: 10px;
        padding: 0;
    }
    
    .wrap h1 {
        font-size: 24px;
        padding: 15px 10px;
        margin: -10px -10px 20px -10px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border-radius: 8px 8px 0 0;
    }
}

/* ==========================================================================
   2. Admin Section - Mobile Optimiert
   ========================================================================== */

@media (max-width: 782px) {
    
    .egb-admin-section {
        margin-bottom: 15px;
        padding: 15px !important;
        border-radius: 12px;
    }
    
    .egb-admin-section h2 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .egb-admin-section h3 {
        font-size: 16px;
        margin-top: 20px;
        margin-bottom: 10px;
    }
}

/* ==========================================================================
   3. Forms - Touch-Friendly
   ========================================================================== */

@media (max-width: 782px) {
    
    /* Input Fields */
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    textarea,
    select {
        width: 100% !important;
        min-height: 44px;
        font-size: 16px !important; /* Verhindert Zoom auf iOS */
        padding: 12px !important;
        border-radius: 8px;
        border: 2px solid #ddd;
        box-shadow: none;
    }
    
    input:focus,
    textarea:focus,
    select:focus {
        border-color: #667eea;
        outline: none;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
    
    /* Textarea */
    textarea {
        min-height: 100px;
    }
    
    /* Form Table */
    .form-table {
        width: 100%;
    }
    
    .form-table th,
    .form-table td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }
    
    .form-table th {
        font-weight: bold;
        padding-bottom: 5px;
    }
    
    .form-table td {
        padding-top: 5px;
        padding-bottom: 15px;
    }
    
    .form-table .description {
        font-size: 13px;
        margin-top: 5px;
    }
}

/* ==========================================================================
   4. Buttons - Touch Optimiert
   ========================================================================== */

@media (max-width: 782px) {
    
    .button,
    .button-primary,
    .button-secondary {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 8px;
        font-weight: 600;
        display: inline-block;
        margin: 5px 5px 5px 0;
        transition: all 0.3s ease;
    }
    
    .button-primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border: none;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    
    .button-primary:hover,
    .button-primary:focus {
        background: linear-gradient(135deg, #5568d3 0%, #6a3f92 100%);
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    }
    
    .button-primary:active {
        transform: translateY(0);
    }
}

/* ==========================================================================
   5. Tables - Responsive Cards
   ========================================================================== */

@media (max-width: 782px) {
    
    /* Table zu Cards */
    .wp-list-table {
        border: none;
    }
    
    .wp-list-table thead {
        display: none;
    }
    
    .wp-list-table tbody {
        display: block;
    }
    
    .wp-list-table tr {
        display: block;
        margin-bottom: 15px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        padding: 15px;
        border: none;
    }
    
    .wp-list-table td {
        display: block;
        text-align: left !important;
        padding: 8px 0 !important;
        border: none;
        position: relative;
        padding-left: 45% !important;
    }
    
    .wp-list-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        font-weight: bold;
        color: #666;
        font-size: 13px;
    }
    
    /* Status Badges größer */
    .egb-status-badge {
        display: inline-block;
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 20px;
    }
}

/* ==========================================================================
   6. Grid Layout - Mobile Stack
   ========================================================================== */

@media (max-width: 782px) {
    
    /* Grid zu Stack */
    [style*="display: grid"] {
        display: block !important;
    }
    
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Flex zu Stack */
    .group-header,
    .egb-pwa-install-banner {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .group-details {
        display: block !important;
    }
}

/* ==========================================================================
   7. Guest Form - Mobile Cards
   ========================================================================== */

@media (max-width: 782px) {
    
    .guest-row {
        margin-bottom: 20px !important;
        padding: 15px !important;
    }
    
    .guest-row > div {
        display: block !important;
    }
    
    .guest-row > div > div {
        margin-bottom: 15px;
    }
    
    .guest-row h4 {
        font-size: 16px;
        margin-bottom: 15px;
    }
}

/* ==========================================================================
   8. Group Bookings - Mobile Cards
   ========================================================================== */

@media (max-width: 782px) {
    
    .group-booking-card {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }
    
    .group-header h3 {
        font-size: 16px;
    }
    
    .group-rooms li {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 12px !important;
    }
    
    .group-rooms li .button {
        margin-top: 10px;
        width: 100%;
    }
}

/* ==========================================================================
   9. PWA Specific - Standalone Mode
   ========================================================================== */

@media (display-mode: standalone) {
    
    /* Entferne WordPress Admin Bar im Standalone Mode */
    #wpadminbar {
        display: none !important;
    }
    
    body.wp-admin {
        padding-top: 0 !important;
    }
    
    /* Add Safe Area für Notch */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    /* PWA Header Bar */
    .wrap h1 {
        position: sticky;
        top: 0;
        z-index: 100;
        margin-top: 0;
    }
}

/* ==========================================================================
   10. Touch Interactions
   ========================================================================== */

/* Touch Feedback */
.button:active,
.wp-list-table tr:active,
.guest-row:active {
    opacity: 0.7;
}

/* Hover States für Touch deaktivieren */
@media (hover: none) {
    .button:hover,
    .button-primary:hover {
        transform: none;
    }
}

/* Scrollbar Style */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==========================================================================
   11. Dashboard Stats - Mobile Grid
   ========================================================================== */

@media (max-width: 782px) {
    
    [style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Stats Cards */
    .wrap > div[style*="display: grid"] > div {
        margin-bottom: 15px;
    }
}

/* ==========================================================================
   12. Modal/Dialog - Full Screen auf Mobile
   ========================================================================== */

@media (max-width: 782px) {
    
    [role="dialog"],
    .modal {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
}

/* ==========================================================================
   13. Accessibility - Touch Targets
   ========================================================================== */

/* Minimum Touch Target Size */
a,
button,
input[type="checkbox"],
input[type="radio"],
select {
    min-width: 44px;
    min-height: 44px;
}

/* Focus Styles */
*:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* ==========================================================================
   14. Loading States
   ========================================================================== */

.egb-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.egb-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: egb-spin 1s linear infinite;
}

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

/* ==========================================================================
   15. Print Styles
   ========================================================================== */

@media print {
    
    .button,
    .wp-list-table td:last-child,
    #wpadminbar {
        display: none !important;
    }
    
    .wrap {
        margin: 0;
        padding: 0;
    }
    
    .egb-admin-section {
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   16. Dark Mode Support (Optional)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    
    .egb-admin-section {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    
    input,
    textarea,
    select {
        background: #2a2a2a;
        color: #e0e0e0;
        border-color: #444;
    }
    
    .wp-list-table tr {
        background: #1e1e1e;
    }
}

/* ==========================================================================
   17. Landscape Orientation
   ========================================================================== */

@media (max-width: 782px) and (orientation: landscape) {
    
    .wrap h1 {
        font-size: 20px;
        padding: 10px;
    }
    
    .form-table th,
    .form-table td {
        display: inline-block;
        width: 48%;
        vertical-align: top;
    }
    
    .form-table th {
        text-align: right;
        padding-right: 10px;
    }
}

/* ==========================================================================
   18. iOS Specific Fixes
   ========================================================================== */

/* iOS Safari fixes */
@supports (-webkit-touch-callout: none) {
    
    input,
    textarea,
    select {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    /* iOS Button styles */
    button,
    .button {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
}

/* ==========================================================================
   19. Pull to Refresh Prevention
   ========================================================================== */

body {
    overscroll-behavior-y: contain;
}

/* ==========================================================================
   20. Bottom Navigation (Optional - für native feel)
   ========================================================================== */

@media (max-width: 782px) and (display-mode: standalone) {
    
    .egb-mobile-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        display: flex;
        justify-content: space-around;
        padding: 10px 0;
        z-index: 1000;
    }
    
    .egb-mobile-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #666;
        text-decoration: none;
        font-size: 12px;
        padding: 5px 10px;
    }
    
    .egb-mobile-nav a.active {
        color: #667eea;
    }
    
    .egb-mobile-nav a::before {
        font-size: 24px;
        margin-bottom: 5px;
    }
}