/* assets/css/form-responsive.css */
/* ===========================================
   RESPONSIVE FORM STYLES
   =========================================== */

/* Base styles for all forms */
form {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Form groups and controls */
.form-group {
    margin-bottom: 1rem;
    width: 100%;
}

.form-control {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

/* Labels */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
}

/* Admin Panel Specific Styles */
.admin-panel {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Responsive Tables */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Form Layouts */
.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -5px;
    margin-left: -5px;
}

.form-row > .col,
.form-row > [class*="col-"] {
    padding-right: 5px;
    padding-left: 5px;
}

/* Media Queries */
@media (max-width: 767.98px) {
    /* Stack form elements on mobile */
    .form-row {
        flex-direction: column;
        margin-right: 0;
        margin-left: 0;
    }
    
    .form-row > .col,
    .form-row > [class*="col-"] {
        padding-right: 0;
        padding-left: 0;
        margin-bottom: 1rem;
    }
    
    /* Make buttons full width on mobile */
    .btn {
        display: block;
        width: 100%;
    }
    
    /* Adjust form controls */
    .form-control {
        font-size: 16px; /* Prevent zoom on focus in iOS */
    }
    
    /* Admin Panel Adjustments */
    .admin-panel .card {
        margin-bottom: 1rem;
    }
    
    .admin-panel .table th,
    .admin-panel .table td {
        white-space: nowrap;
        padding: 0.5rem;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .form-inline .form-control {
        display: inline-block;
        width: auto;
        vertical-align: middle;
    }
}

/* Fix for select elements on mobile */
select.form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20d%3D%22M6%208.8L1.2%204%202%202.8l4%204%204-4L10.8%204z%22%20fill%3D%22%23333%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px 12px;
    padding-right: 2.25rem;
}

/* Fix for checkboxes and radio buttons */
.form-check {
    position: relative;
    display: block;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    position: absolute;
    margin-top: 0.3rem;
    margin-left: -1.5rem;
}

/* Error messages */
.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 80%;
    color: #dc3545;
}

/* Loading states */
.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.is-loading:after {
    content: "";
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.75s linear infinite;
    margin-left: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
