/**
 * Leonards Homes - Custom Styles
 * Additional styles beyond Tailwind CSS
 */

/* ============================================
   Custom Scrollbar
   ============================================ */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Light scrollbar for light backgrounds */
.custom-scrollbar-light::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar-light::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}

.custom-scrollbar-light::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 4px;
}

.custom-scrollbar-light::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* ============================================
   Animations
   ============================================ */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes pulse-soft {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.animate-shimmer {
    background: linear-gradient(90deg, #f8fafc 0%, #e2e8f0 50%, #f8fafc 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.animate-pulse-soft {
    animation: pulse-soft 2s infinite;
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}

.animate-slide-up {
    animation: slide-up 0.3s ease-out;
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

/* ============================================
   Utility Classes
   ============================================ */
.glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.shadow-premium {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08),
                0 12px 24px -8px rgba(0, 0, 0, 0.04);
}

.mesh-background {
    background-color: #f8fafc;
    background-image: 
        radial-gradient(at 40% 20%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
        radial-gradient(at 80% 0%, rgba(139, 92, 246, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 50%, rgba(6, 182, 212, 0.1) 0px, transparent 50%),
        radial-gradient(at 80% 50%, rgba(236, 72, 153, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(34, 197, 94, 0.1) 0px, transparent 50%);
}

/* ============================================
   Form Styles
   ============================================ */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    font-weight: 600;
    color: #334155;
    outline: none;
    transition: all 0.2s;
}

.form-input:focus {
    background-color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-input.error {
    border-color: #f43f5e;
}

.form-input.error:focus {
    box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.1);
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.form-error {
    font-size: 0.75rem;
    color: #f43f5e;
    margin-top: 0.25rem;
}

/* ============================================
   Button Styles
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 0.75rem;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    outline: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background-color: #2563eb;
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-secondary {
    background-color: #ffffff;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #f8fafc;
}

.btn-danger {
    background-color: #f43f5e;
    color: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background-color: #e11d48;
}

.btn-success {
    background-color: #10b981;
    color: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.3);
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.65rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 0.875rem;
}

/* ============================================
   Table Styles
   ============================================ */
.data-table {
    width: 100%;
    text-align: left;
}

.data-table thead tr {
    background-color: rgba(248, 250, 252, 0.5);
    border-bottom: 1px solid #f1f5f9;
}

.data-table th {
    padding: 1.25rem 1.5rem;
    font-size: 0.625rem;
    font-weight: 900;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.data-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.15s;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.data-table td {
    padding: 1.25rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
}

/* Table wrapper for horizontal scroll on mobile */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
}

/* ============================================
   Card Styles
   ============================================ */
.card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1.5rem;
    border-top: 1px solid #f1f5f9;
    background-color: #f8fafc;
}

/* ============================================
   Badge Styles
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.625rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 9999px;
}

.badge-success {
    background-color: #d1fae5;
    color: #047857;
}

.badge-warning {
    background-color: #fef3c7;
    color: #b45309;
}

.badge-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

.badge-info {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.badge-default {
    background-color: #f1f5f9;
    color: #475569;
}

/* ============================================
   Modal Styles
   ============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 50;
}

.modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    background-color: #ffffff;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 51;
}

/* ============================================
   Loading States
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    body {
        background: white !important;
    }
    
    .no-print,
    aside,
    header,
    footer,
    nav {
        display: none !important;
    }
    
    main {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
    }
}

/* ============================================
   Responsive Utilities
   ============================================ */
@media (max-width: 640px) {
    .data-table th,
    .data-table td {
        padding: 0.75rem 1rem;
    }
    
    .btn {
        padding: 0.625rem 1rem;
    }
}

/* ============================================
   Student Application Form Styles
   ============================================ */
.transition-soft {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes fade-in-up {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in-down {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up { 
    animation: fade-in-up 0.8s ease-out forwards; 
}

.animate-fade-in-down { 
    animation: fade-in-down 0.8s ease-out forwards; 
}

/* Hide icons by default for cleaner look */
.input-icon {
    display: none !important;
}

.input-group:focus-within .input-icon {
    color: #3b82f6;
}

/* Clean, modern input style without icons */
.input-with-icon,
.form-field {
    width: 100%;
    background-color: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1rem 1.25rem !important;
    padding-left: 1.25rem !important;
    color: #0f172a;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.25s ease;
}

.input-with-icon:hover,
.form-field:hover {
    border-color: #cbd5e1;
}

.input-with-icon:focus,
.form-field:focus {
    background-color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08), 0 4px 12px rgba(59, 130, 246, 0.08);
    outline: none;
}

.input-with-icon::placeholder,
.form-field::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.input-with-icon.error,
.form-field.error {
    border-color: #f43f5e;
    box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.08);
}

/* Select dropdown styling */
select.input-with-icon,
select.form-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 1rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    padding-right: 3rem;
    cursor: pointer;
}

/* Textarea styling */
textarea.input-with-icon,
textarea.form-field {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* File input styling */
input[type="file"].input-with-icon,
input[type="file"].form-field {
    padding: 0.75rem 1rem;
    cursor: pointer;
}

input[type="file"].input-with-icon::file-selector-button,
input[type="file"].form-field::file-selector-button {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer;
    margin-right: 1rem;
    transition: all 0.2s;
}

input[type="file"].input-with-icon::file-selector-button:hover,
input[type="file"].form-field::file-selector-button:hover {
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    transform: translateY(-1px);
}

/* Date input fix for better appearance */
input[type="date"].input-with-icon,
input[type="date"].form-field {
    cursor: pointer;
}

.radio-card {
    cursor: pointer;
}

.radio-card input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.radio-card-content {
    width: 100%;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    color: #475569;
    font-weight: 500;
    transition: all 0.2s;
}

.radio-card-content:hover {
    background-color: #f8fafc;
}

.radio-card input[type="radio"]:checked + .radio-card-content {
    border-color: #3b82f6;
    background-color: #eff6ff;
    color: #1d4ed8;
    box-shadow: 0 0 0 1px #3b82f6;
}

.radio-card input[type="radio"]:checked + .radio-card-content.amber {
    border-color: #f59e0b;
    background-color: #fffbeb;
    color: #b45309;
    box-shadow: 0 0 0 1px #f59e0b;
}

.upload-zone {
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 2px dashed #e2e8f0;
    background-color: rgba(248, 250, 252, 0.5);
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover {
    border-color: #3b82f6;
    background-color: rgba(239, 246, 255, 0.3);
}

.upload-zone.has-file {
    border-style: solid;
    border-color: #3b82f6;
}

.upload-zone img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #ffffff;
    font-weight: 900;
    font-size: 1.25rem;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.3);
}

.confidential-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    box-shadow: 0 4px 15px -3px currentColor;
}

.confidential-badge.blue {
    background-color: #3b82f6;
    color: #ffffff;
}

.confidential-badge.amber {
    background-color: #f59e0b;
    color: #ffffff;
}

.btn-gradient {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 3rem;
    background: linear-gradient(90deg, #3b82f6 0%, #6366f1 50%, #3b82f6 100%);
    background-size: 200% auto;
    color: #ffffff;
    font-weight: 900;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    border-radius: 1rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.3);
    transition: all 0.5s;
}

.btn-gradient:hover {
    background-position: right center;
    transform: translateY(-2px);
    box-shadow: 0 15px 35px -5px rgba(59, 130, 246, 0.4);
}

.btn-gradient:active {
    transform: scale(0.98);
}

[x-cloak] { 
    display: none !important; 
}

/* ============================================
   Enhanced Form Label Styles
   ============================================ */
.form-label-modern {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.form-label-modern .required {
    color: #ef4444;
    margin-left: 0.125rem;
}

/* Cleaner space-y for form fields */
.form-group {
    margin-bottom: 1.5rem;
}

/* Form input container with floating label effect */
.form-floating {
    position: relative;
}

.form-floating input,
.form-floating select,
.form-floating textarea {
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
}

.form-floating label {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    font-size: 0.9375rem;
    font-weight: 500;
    color: #94a3b8;
    pointer-events: none;
    transition: all 0.2s ease;
}

.form-floating input:focus ~ label,
.form-floating input:not(:placeholder-shown) ~ label,
.form-floating select:focus ~ label,
.form-floating select:valid ~ label,
.form-floating textarea:focus ~ label,
.form-floating textarea:not(:placeholder-shown) ~ label {
    top: 0.75rem;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #3b82f6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Clean radio button styling */
.radio-modern {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-modern:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.radio-modern.selected {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
}

.radio-modern input[type="radio"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: #3b82f6;
}

/* Clean checkbox styling */
.checkbox-modern {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.checkbox-modern input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: #3b82f6;
    border-radius: 0.375rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

/* Form section divider */
.form-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
}

.form-divider span {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Clean focus ring */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Error state for form groups */
.form-group.has-error .form-label-modern {
    color: #ef4444;
}

.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border-color: #f43f5e;
}

/* Helper text */
.form-helper {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.375rem;
}

.form-error-text {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
