/* ============================================
   PROSYD ACADEMY - FORM & TABLE MOBILE ENHANCEMENTS
   Specific responsive styles for forms and tables
   ============================================ */

/* ============================================
   ENHANCED FORM STYLES FOR MOBILE
   ============================================ */

/* Form Container Mobile */
@media (max-width: 768px) {
    .form-container,
    .booking-form,
    .registration-form,
    .contact-form {
        padding: 20px 15px;
    }
    
    /* Form Card */
    .form-card {
        border-radius: 15px;
        padding: 25px 20px;
        margin-bottom: 20px;
    }
    
    /* Form Header */
    .form-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 2px solid var(--border-color);
    }
    
    .form-header h3 {
        font-size: 1.4rem;
        margin-bottom: 8px;
    }
    
    .form-header p {
        font-size: 0.9rem;
    }
}

/* Form Groups and Fields */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-label {
        font-size: 0.95rem;
        font-weight: 600;
        margin-bottom: 8px;
        display: block;
    }
    
    .required-label::after {
        content: " *";
        color: #dc3545;
    }
    
    /* Input Fields */
    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents iOS zoom */
        height: auto;
        min-height: 48px;
        padding: 12px 16px;
        border-radius: 10px;
        border: 2px solid var(--border-color);
        transition: all 0.3s ease;
        width: 100%;
    }
    
    .form-control:focus,
    .form-select:focus {
        border-color: var(--primary-green);
        box-shadow: 0 0 0 0.2rem rgba(45, 80, 22, 0.15);
        outline: none;
    }
    
    /* Textarea */
    textarea.form-control {
        min-height: 120px;
        resize: vertical;
    }
    
    /* Select Dropdown */
    .form-select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%232d5016' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 16px 12px;
        padding-right: 40px;
    }
}

/* Input Group Mobile */
@media (max-width: 768px) {
    .input-group {
        flex-wrap: nowrap;
    }
    
    .input-group-text {
        padding: 12px 15px;
        border-radius: 10px 0 0 10px;
        border: 2px solid var(--border-color);
        background: var(--light-gray);
        font-size: 0.95rem;
    }
    
    .input-group .form-control {
        border-left: none;
        border-radius: 0 10px 10px 0;
    }
    
    .input-group .btn {
        border-radius: 0 10px 10px 0;
        padding: 12px 20px;
        white-space: nowrap;
    }
}

/* Checkbox and Radio Mobile */
@media (max-width: 768px) {
    .form-check {
        padding-left: 0;
        margin-bottom: 12px;
    }
    
    .form-check-input {
        width: 22px;
        height: 22px;
        margin-top: 2px;
        margin-right: 10px;
        float: left;
        cursor: pointer;
    }
    
    .form-check-label {
        display: block;
        padding-left: 35px;
        cursor: pointer;
        line-height: 1.6;
        font-size: 0.95rem;
    }
    
    .form-check-inline {
        display: flex;
        align-items: center;
        margin-right: 15px;
        margin-bottom: 10px;
    }
}

/* File Upload Mobile */
@media (max-width: 768px) {
    .form-control[type="file"] {
        padding: 12px;
        cursor: pointer;
    }
    
    .custom-file-upload {
        display: inline-block;
        padding: 12px 20px;
        cursor: pointer;
        background: var(--light-gray);
        border: 2px dashed var(--border-color);
        border-radius: 10px;
        text-align: center;
        transition: all 0.3s ease;
        width: 100%;
    }
    
    .custom-file-upload:hover {
        border-color: var(--primary-green);
        background: rgba(45, 80, 22, 0.05);
    }
    
    .custom-file-upload i {
        font-size: 2rem;
        color: var(--primary-green);
        display: block;
        margin-bottom: 10px;
    }
}

/* Form Validation Mobile */
@media (max-width: 768px) {
    .invalid-feedback,
    .error-message {
        font-size: 0.85rem;
        color: #dc3545;
        margin-top: 6px;
        display: block;
    }
    
    .valid-feedback,
    .success-message {
        font-size: 0.85rem;
        color: #28a745;
        margin-top: 6px;
        display: block;
    }
    
    .form-control.is-invalid {
        border-color: #dc3545;
    }
    
    .form-control.is-valid {
        border-color: #28a745;
    }
}

/* Form Buttons Mobile */
@media (max-width: 768px) {
    .form-actions,
    .form-footer {
        margin-top: 25px;
        padding-top: 20px;
        border-top: 1px solid var(--border-color);
    }
    
    .form-actions .btn,
    .form-footer .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 10px;
        border-radius: 10px;
    }
    
    .btn-submit,
    .btn-primary {
        order: 1;
    }
    
    .btn-cancel,
    .btn-secondary {
        order: 2;
    }
    
    .form-actions {
        display: flex;
        flex-direction: column;
    }
}

/* Multi-step Forms Mobile */
@media (max-width: 768px) {
    .step-indicator {
        display: flex;
        justify-content: space-between;
        margin-bottom: 30px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .step {
        flex: 1;
        text-align: center;
        position: relative;
        padding: 10px 5px;
        min-width: 80px;
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        background: var(--light-gray);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto 8px;
        font-weight: 600;
        color: var(--dark-gray);
        font-size: 1rem;
    }
    
    .step.active .step-number {
        background: var(--primary-green);
        color: white;
    }
    
    .step.completed .step-number {
        background: var(--secondary-green);
        color: white;
    }
    
    .step-label {
        font-size: 0.8rem;
        color: var(--dark-gray);
        display: block;
    }
    
    .step.active .step-label {
        font-weight: 600;
        color: var(--primary-green);
    }
}

/* ============================================
   ENHANCED TABLE STYLES FOR MOBILE
   ============================================ */

/* Table Wrapper Mobile */
@media (max-width: 768px) {
    .table-wrapper,
    .table-container {
        margin: 0 -15px 20px;
        padding: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-responsive {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* Standard Table Mobile - Horizontal Scroll */
@media (max-width: 768px) {
    table.table {
        font-size: 0.85rem;
        min-width: 600px;
    }
    
    table.table th,
    table.table td {
        padding: 10px 12px;
        white-space: nowrap;
    }
    
    table.table thead th {
        font-size: 0.8rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        background: var(--primary-green);
        color: white;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    table.table tbody tr {
        border-bottom: 1px solid var(--border-color);
    }
    
    table.table tbody tr:hover {
        background: rgba(45, 80, 22, 0.03);
    }
}

/* Stacked Table Mobile - Cards Layout */
@media (max-width: 768px) {
    table.table-mobile-cards {
        border: 0;
        min-width: 100%;
    }
    
    table.table-mobile-cards thead {
        display: none;
    }
    
    table.table-mobile-cards tbody,
    table.table-mobile-cards tr,
    table.table-mobile-cards td {
        display: block;
        width: 100%;
    }
    
    table.table-mobile-cards tr {
        margin-bottom: 20px;
        border: 2px solid var(--border-color);
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        background: white;
    }
    
    table.table-mobile-cards td {
        text-align: right;
        padding: 12px 15px;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        padding-left: 50%;
    }
    
    table.table-mobile-cards td:last-child {
        border-bottom: none;
    }
    
    table.table-mobile-cards td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: var(--primary-green);
        text-align: left;
    }
    
    /* Action Buttons in Table */
    table.table-mobile-cards td.actions-cell {
        text-align: center;
        padding-left: 15px;
    }
    
    table.table-mobile-cards td.actions-cell::before {
        content: none;
    }
    
    table.table-mobile-cards .btn {
        margin: 5px;
        padding: 8px 15px;
        font-size: 0.85rem;
    }
}

/* Compact Table for Mobile */
@media (max-width: 768px) {
    table.table-sm {
        font-size: 0.8rem;
    }
    
    table.table-sm th,
    table.table-sm td {
        padding: 8px 10px;
    }
}

/* Table Actions Mobile */
@media (max-width: 768px) {
    .table-actions {
        margin-bottom: 15px;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .table-actions .btn {
        flex: 1;
        min-width: 120px;
        font-size: 0.9rem;
        padding: 10px 15px;
    }
    
    .table-actions .form-control {
        flex: 1;
        min-width: 150px;
    }
}

/* Table Pagination Mobile */
@media (max-width: 768px) {
    .table-pagination {
        display: flex;
        justify-content: center;
        margin-top: 20px;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .page-item {
        margin: 0;
    }
    
    .page-link {
        padding: 8px 12px;
        font-size: 0.9rem;
        border-radius: 6px;
    }
}

/* Data Tables Mobile Enhancement */
@media (max-width: 768px) {
    .dataTables_wrapper {
        padding: 0;
    }
    
    .dataTables_filter {
        margin-bottom: 15px;
    }
    
    .dataTables_filter input {
        width: 100%;
        margin-left: 0;
        margin-top: 5px;
    }
    
    .dataTables_length select {
        width: auto;
        display: inline-block;
    }
    
    .dataTables_info {
        text-align: center;
        padding: 10px 0;
        font-size: 0.85rem;
    }
}

/* ============================================
   SPECIFIC FORM PAGES MOBILE STYLES
   ============================================ */

/* Booking Form Mobile */
@media (max-width: 768px) {
    .booking-form .participant-row {
        background: var(--light-gray);
        padding: 15px;
        border-radius: 10px;
        margin-bottom: 15px;
    }
    
    .booking-form .participant-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 2px solid white;
    }
    
    .booking-form .remove-participant {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* Registration Form Mobile */
@media (max-width: 768px) {
    .registration-summary {
        background: var(--light-gray);
        padding: 20px;
        border-radius: 12px;
        margin-bottom: 20px;
    }
    
    .summary-item {
        display: flex;
        justify-content: space-between;
        padding: 10px 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .summary-item:last-child {
        border-bottom: none;
        font-weight: 600;
        font-size: 1.1rem;
        color: var(--primary-green);
    }
}

/* Search Form Mobile */
@media (max-width: 768px) {
    .search-form {
        margin-bottom: 25px;
    }
    
    .search-form .input-group {
        flex-wrap: nowrap;
    }
    
    .search-form .form-control {
        min-width: 0;
        flex: 1;
    }
    
    .search-form .btn {
        white-space: nowrap;
        padding: 12px 20px;
    }
}

/* Filter Form Mobile */
@media (max-width: 768px) {
    .filter-section {
        background: var(--light-gray);
        padding: 20px;
        border-radius: 12px;
        margin-bottom: 20px;
    }
    
    .filter-toggle {
        display: block;
        width: 100%;
        padding: 12px 20px;
        background: var(--primary-green);
        color: white;
        border: none;
        border-radius: 10px;
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 15px;
        cursor: pointer;
    }
    
    .filter-content {
        display: none;
    }
    
    .filter-content.show {
        display: block;
    }
    
    .filter-row {
        margin-bottom: 15px;
    }
}

/* ============================================
   RESPONSIVE UTILITIES FOR FORMS & TABLES
   ============================================ */

@media (max-width: 768px) {
    /* Hide columns on mobile */
    .hide-mobile,
    td.hide-mobile,
    th.hide-mobile {
        display: none !important;
    }
    
    /* Show only on mobile */
    .show-mobile {
        display: block !important;
    }
    
    /* Stack form rows */
    .form-row {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    .form-row [class*="col-"] {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }
}

/* Very Small Screens */
@media (max-width: 480px) {
    .form-card {
        padding: 20px 15px;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
        padding: 10px 14px;
    }
    
    table.table-mobile-cards td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    table.table-mobile-cards td::before {
        font-size: 0.8rem;
    }
}
