/* Voice Corpus Application - Custom Styles */
/* Sindhi Language (RTL) - Enhanced for Accessibility */
/* Designed for users with poor eyesight - Large fonts, high contrast, clear spacing */

/* Local Ambile fonts (heading + regular) */
@font-face {
    font-family: 'AmbileHeading';
    src: url('../fonts/heading/ambile-heading.woff2') format('woff2'),
         url('../fonts/heading/ambile-heading.woff') format('woff'),
         url('../fonts/heading/ambile-heading.ttf') format('truetype');
    font-weight: 700 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'AmbileRegular';
    src: url('../fonts/regular/ambile-regular.woff2') format('woff2'),
         url('../fonts/regular/ambile-regular.woff') format('woff'),
         url('../fonts/regular/ambile-regular.ttf') format('truetype');
    font-weight: 100 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-heading: 'AmbileHeading', serif;
    --font-ui: 'AmbileRegular', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    
    /* Enhanced Color Palette - High Contrast */
    --primary-color: #227d53;
    --primary-hover: #13452d;
    --primary-light: #5fbd92;
    --text-dark: #1a1a1a;
    --text-light: #ffffff;
    --bg-light: #f8f9fa;
    --bg-dark: #0b1020;
    --border-light: #e2e8f0;
    --border-dark: #2d3748;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

/* Global transitions for smooth UI */
* {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-duration: 200ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Disable transitions on page load */
.preload * {
    transition: none !important;
}

/* Pulse animation delays for staggered effects */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.delay-75 {
    animation-delay: 75ms;
}

.delay-150 {
    animation-delay: 150ms;
}

/* Apply AmbileRegular as the default UI font; headings use AmbileHeading */
body {
    font-family: var(--font-ui);
    font-size: 1rem;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.4;
}

/* Normal heading sizes */
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

/* Smooth Transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

/* Custom Scrollbar - Larger for better usability */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 8px;
}

.dark ::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 8px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
    background-clip: padding-box;
}

/* Enhanced Focus Styles for Accessibility */
input:focus,
textarea:focus,
select:focus,
button:focus {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    transition: all 200ms ease;
}

/* High contrast focus for dark mode */
.dark input:focus,
.dark textarea:focus,
.dark select:focus,
.dark button:focus {
    outline: 3px solid #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.2);
}

/* Card Hover Effect - Enhanced */
.card-hover {
    transition: transform 300ms ease, box-shadow 300ms ease;
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Button Animations - Enhanced */
button {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    font-weight: 600;
    min-height: 40px;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    transition: all 200ms ease;
}

/* Input & Form transitions */
input,
textarea,
select {
    transition: border-color 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}

/* Link transitions */
a {
    transition: color 200ms ease, opacity 200ms ease;
}
s

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::before {
    width: 400px;
    height: 400px;
}

/* Enhanced button states */
button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

/* Table Styles */
table {
    border-collapse: separate;
    border-spacing: 0;
}

table th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Recording Animation */
@keyframes recording {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.recording-active {
    animation: recording 1.5s ease-in-out infinite;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
}

/* Responsive Text Sizes */
@media (max-width: 768px) {
    button {
        min-height: 44px;
        padding: 0.625rem 1.25rem;
    }
}

/* Splash screen styles */
#splashScreen {
    transition: opacity 300ms ease, visibility 300ms ease;
}
#splashScreen.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Lazy-loaded media placeholder */
.lazy-placeholder {
    background: linear-gradient(90deg, rgba(0,0,0,0.03) 0%, rgba(0,0,0,0.05) 50%, rgba(0,0,0,0.03) 100%);
    min-height: 48px;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Custom Toggle Switch - Fixed */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e0;
    transition: 0.4s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(28px);
}

input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(34, 125, 83, 0.2);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-state svg {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

/* Responsive sidebar overlay for mobile/tablet */
@media (max-width: 1024px) {
    #appSidebar {
        display: none; /* hidden by default on mobile/tablet */
        position: fixed;
        inset: 0;
        width: 100%;
        z-index: 60;
        padding-top: 3.5rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.sidebar-mobile-open #appSidebar {
        display: flex;
        flex-direction: column;
    }

    /* Close button spacing / appearance */
    #mobileSidebarClose {
        display: inline-flex;
        z-index: 70;
    }
}

/* Toast styles */
#toastContainer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    pointer-events: none;
}
.toast-item {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 250ms ease, transform 250ms ease;
}
.toast-item.hide {
    opacity: 0;
    transform: translateY(-8px) scale(.98);
}

/* Spacious components utility - add generous padding inside cards */
.spacious {
    padding: 2.5rem !important; /* a lot of space */
}

/* Slightly larger border-radius and relaxed line-height for modern feel */
.rounded-modern {
    border-radius: 12px !important;
}

/* Emoji-friendly heading spacing */
.emoji-heading {
    display: inline-flex;
    gap: 0.75rem;
    align-items: center;
}

/* ========================================
   ENHANCED ACCESSIBILITY UTILITIES
   ======================================== */

/* Large touch targets for mobile */
.touch-target {
    min-height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* High contrast text */
.text-high-contrast {
    color: #000000;
    font-weight: 600;
}

.dark .text-high-contrast {
    color: #ffffff;
}

/* Large spacing utilities */
.space-y-large > * + * {
    margin-top: 2rem;
}

.space-x-large > * + * {
    margin-right: 2rem;
}

/* Enhanced card styles */
.card-enhanced {
    border: 2px solid var(--border-light);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.dark .card-enhanced {
    border-color: var(--border-dark);
}

.card-enhanced:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

/* Input enhancements */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
    min-height: 52px;
    font-size: 1.125rem;
    padding: 0.875rem 1rem;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.dark input[type="text"],
.dark input[type="password"],
.dark input[type="email"],
.dark input[type="number"],
.dark textarea,
.dark select {
    border-color: #4a5568;
}

input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover,
input[type="number"]:hover,
textarea:hover,
select:hover {
    border-color: #a0aec0;
}

/* Status badges - larger and more visible */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Loading spinner - larger */
.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #f3f4f6;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Alert boxes - more prominent */
.alert {
    padding: 1.25rem 1.5rem;
    border-radius: 10px;
    border-left: 5px solid;
    font-size: 1.125rem;
    font-weight: 500;
}

.alert-info {
    background-color: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.alert-success {
    background-color: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.alert-error {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

/* Icon sizing for better visibility */
.icon-sm { width: 1.25rem; height: 1.25rem; }
.icon-md { width: 1.75rem; height: 1.75rem; }
.icon-lg { width: 2.5rem; height: 2.5rem; }
.icon-xl { width: 3.5rem; height: 3.5rem; }

/* Skeleton loading states */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.dark .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

/* Divider */
.divider {
    height: 2px;
    background-color: #e5e7eb;
    margin: 2rem 0;
}

.dark .divider {
    background-color: #374151;
}

/* Gradient backgrounds */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
}

/* Print optimization */
@media print {
    body {
        font-size: 12pt;
    }
    
    h1 { font-size: 24pt; }
    h2 { font-size: 20pt; }
    h3 { font-size: 16pt; }
    
    button, .no-print {
        display: none !important;
    }
}
