/* app/static/custom.css - Enhanced Dashboard Styles */

/* --- Import Font --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
}

/* --- Card Shadows & Premium Effects --- */
.shadow-premium {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

.shadow-2xl {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.drop-shadow-md {
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* --- Line Clamp --- */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Shine Effect for Buttons --- */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20%;
    height: 200%;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(30deg);
    transition: none;
    pointer-events: none;
}

.btn-shine:hover::after {
    left: 150%;
    transition: left 0.7s ease-in-out;
}

.btn-shine:hover {
    color: white !important;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* --- Active UI Elements --- */
.active\:scale-95:active {
    transform: scale(0.95);
}

.active\:scale-90:active {
    transform: scale(0.90);
}

.backdrop-blur-sm {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.backdrop-blur-md {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* --- iOS Sort Mode: Jiggle Animation --- */
@keyframes jiggle {
    0% { transform: rotate(-1deg); }
    50% { transform: rotate(1deg); }
    100% { transform: rotate(-1deg); }
}

.is-manual-sorting .group {
    animation: jiggle 0.3s infinite ease-in-out;
    cursor: grab;
}

.is-manual-sorting .group:nth-child(even) {
    animation-duration: 0.28s;
}

.is-manual-sorting .group:nth-child(3n) {
    animation-duration: 0.32s;
}

/* SortableJS Enhanced Drag & Drop */
.sortable-ghost {
    opacity: 0.2 !important;
    transform: scale(0.9) !important;
    filter: blur(4px) !important;
}

/* --- View Transition API (iPhone Style) --- */
::view-transition-old(*),
::view-transition-new(*) {
    animation-duration: 0.5s;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Memastikan kartu tidak kedip saat transisi */
.group {
    contain: layout;
}

.sortable-chosen {
    animation: none !important; /* Stop jiggle when being dragged */
    scale: 1.05 !important;
    cursor: grabbing !important;
    z-index: 100 !important;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.25) !important;
}

.sortable-drag {
    opacity: 1 !important;
}

/* --- Safe Area for iPhone/Modern Android --- */
.safe-area-bottom {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

/* --- Mobile Bottom Sheet Modals --- */
@media (max-width: 640px) {
    .modal {
        align-items: flex-end !important;
    }

    .modal > div {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 2.5rem 2.5rem 0 0 !important;
        margin-bottom: 0 !important;
        animation: slideUpMobile 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    @keyframes slideUpMobile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* Hide horizontal scrollbar for sort buttons */
    .overflow-x-auto::-webkit-scrollbar {
        display: none;
    }
    .overflow-x-auto {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    /* Adjust page padding for Bottom Menu */
    .page-transition {
        padding-bottom: 5rem !important;
    }
}

/* --- iPad & Tablet Optimizations --- */
@media (min-width: 641px) and (max-width: 1023px) {
    #class-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* --- Sidebar Transitions --- */
.sidebar-transition {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 1024px) {
    .sidebar-collapsed {
        margin-left: -18rem; /* Width of the sidebar (w-72) */
    }
    
    .main-content-expanded {
        margin-left: 0 !important;
    }
}

/* iPad/Tablet Overlay Style */
@media (min-width: 641px) and (max-width: 1023px) {
    .sidebar-overlay {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        box-shadow: 20px 0 50px rgba(0,0,0,0.1);
    }
    
    .sidebar-hidden-tablet {
        transform: translateX(-100%);
    }
}

/* Toggle Button Styling */
.sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    background: white;
    border: 1px border-gray-200;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    display: flex;
    items-center: center;
    justify-content: center;
    color: #4b5563;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: #f9fafb;
    color: #2563eb;
    transform: scale(1.1);
}

/* --- Touch Optimizations --- */
button, a {
    min-height: 44px; /* iOS Human Interface Guideline */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 0.75rem;
}
