/**
 * Admin Global Styles
 * Comprehensive CSS file for all admin panel components
 */

/* ===========================================
   GLOBAL ADMIN STYLES
   =========================================== */

/* Admin Navigation Items */
.admin-nav-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #d1d5db;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
}

.admin-nav-item:hover {
    background-color: #374151;
    color: white;
    transform: translateX(4px);
}

.admin-nav-item.active {
    background-color: #1f2937;
    color: white;
    border-left: 4px solid #3b82f6;
    margin-left: 0.5rem;
    border-radius: 0 0.375rem 0.375rem 0;
}

.admin-nav-item i {
    width: 1.25rem;
    text-align: center;
    margin-right: 0.75rem;
}

/* ===========================================
   LOGOUT WARNING STYLES (GLOBAL)
   =========================================== */

/* Primary logout warning for buttons/links */
.logout-warning {
    transition: all 0.3s ease;
    position: relative;
}

.logout-warning:hover {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
    border-color: #fecaca !important;
    transform: translateX(4px);
}

.logout-warning:hover::after {
    content: '⚠️ Logout?';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: #dc2626;
    font-weight: bold;
    animation: pulse 1s infinite;
}

/* Sidebar logout specific styling */
.admin-nav-logout:hover {
    background-color: #dc2626 !important;
    color: white !important;
    border-left: 4px solid #ef4444 !important;
}

/* Button-style logout */
.admin-logout-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.admin-logout-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    color: white !important;
}

.admin-logout-btn:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 0.6s ease-in-out;
}

/* ===========================================
   ADMIN FORMS & COMPONENTS
   =========================================== */

/* Form containers */
.admin-form-container {
    transition: all 0.3s ease;
}

.admin-form-container:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Admin cards */
.admin-card {
    transition: all 0.3s ease;
}

.admin-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Admin buttons */
.admin-btn {
    transition: all 0.2s ease;
}

.admin-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ===========================================
   MENU/SUBMENU SPECIFIC STYLES
   =========================================== */

.submenu-item {
    cursor: pointer !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.submenu-item:hover {
    background-color: #f3f4f6 !important;
    border-color: #d1d5db !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Breadcrumb styling */
.admin-breadcrumb {
    transition: color 0.2s ease;
}

.admin-breadcrumb:hover {
    color: #1d4ed8 !important;
}

/* ===========================================
   ALERTS & MESSAGES
   =========================================== */

.admin-alert {
    animation: slideInDown 0.3s ease-out;
}

/* ===========================================
   ANIMATIONS
   =========================================== */

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================================
   SIDEBAR SPECIFIC
   =========================================== */

.admin-sidebar {
    transition: transform 0.3s ease-in-out;
}

.admin-sidebar.collapsed {
    transform: translateX(-100%);
}

/* ===========================================
   SIDEBAR TOGGLE FUNCTIONALITY
   =========================================== */

/* Base sidebar styling */
#admin-sidebar {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

/* Expanded state (default) */
.sidebar-expanded {
    width: 16rem; /* w-64 equivalent */
}

/* Collapsed state */
.sidebar-collapsed {
    width: 4rem; /* w-16 equivalent - only show icons */
}

/* Toggle button positioning */
#sidebar-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(55, 65, 81, 0.5);
    border: 1px solid rgba(156, 163, 175, 0.3);
    z-index: 10;
}

#sidebar-toggle:hover {
    background-color: rgba(55, 65, 81, 0.8);
    border-color: rgba(156, 163, 175, 0.5);
}

/* Toggle icon rotation */
.sidebar-toggle-icon {
    transition: transform 0.3s ease;
}

.sidebar-collapsed .sidebar-toggle-icon {
    transform: rotate(180deg);
}

/* Text and icon behavior in collapsed state */
.sidebar-collapsed .sidebar-text {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    left: -200px;
    transition: all 0.2s ease;
}

.sidebar-expanded .sidebar-text {
    opacity: 1;
    pointer-events: auto;
    position: relative;
    left: 0;
    transition: all 0.3s ease 0.1s; /* Delay for smooth appearance */
}

/* Navigation items in collapsed state */
.sidebar-collapsed .admin-nav-item {
    padding: 0.75rem 0.5rem;
    margin: 0.125rem 0.25rem;
    text-align: center;
    position: relative;
    justify-content: center;
    display: flex;
    align-items: center;
}

.sidebar-collapsed .nav-icon {
    margin-right: 0 !important;
    width: auto;
    text-align: center;
    font-size: 1.25rem;
}

/* Tooltip for collapsed items */
.sidebar-collapsed .admin-nav-item {
    position: relative;
}

.sidebar-collapsed .admin-nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background-color: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    margin-left: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sidebar-collapsed .admin-nav-item:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Header area adjustments for collapsed state */
.sidebar-collapsed .p-4 {
    padding: 1rem 0.5rem;
    text-align: center;
}

/* Main content adjustment when sidebar is collapsed */
#main-content {
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

.sidebar-collapsed ~ #main-content {
    margin-left: 0;
}

/* Body state classes for additional styling */
body.sidebar-is-collapsed #main-content {
    /* Additional styles when sidebar is collapsed */
}

body.sidebar-is-mobile #admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 50;
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.3);
}

/* Header adjustments for mobile toggle button */
@media (max-width: 768px) {
    .admin-header {
        padding-left: 4rem; /* Make room for mobile menu button */
    }
}

/* Responsive behavior */
@media (max-width: 768px) {
    #admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 50;
        box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar-collapsed {
        transform: translateX(-100%);
    }
    
    .mobile-sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 40;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }
}

/* Animation for smooth transitions */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-10px);
    }
}

.sidebar-expanded .sidebar-text {
    animation: slideIn 0.3s ease 0.1s both;
}

.sidebar-collapsed .sidebar-text {
    animation: slideOut 0.2s ease both;
}

/* ===========================================
   DRAG & DROP STYLES
   =========================================== */

.menu-item-draggable,
.submenu-item-draggable {
    cursor: grab;
    transition: background-color 0.2s ease;
}

.menu-item-draggable:hover,
.submenu-item-draggable:hover {
    background-color: #f8fafc;
}

.menu-item-draggable:active,
.submenu-item-draggable:active {
    cursor: grabbing;
}

.dragging {
    opacity: 0.4 !important;
    background: linear-gradient(145deg, #f8fafc, #e2e8f0) !important;
    border: 2px dashed #94a3b8 !important;
    color: #64748b !important;
    transform: scale(0.98) !important;
    transition: all 0.3s ease !important;
    z-index: 1 !important;
    border-radius: 6px !important;
    margin: 8px 0 !important;
    position: relative;
}

/* Ghost placeholder effect */
.dragging::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 8px,
        rgba(148, 163, 184, 0.2) 8px,
        rgba(148, 163, 184, 0.2) 16px
    );
    border-radius: 6px;
    pointer-events: none;
    z-index: 1;
}

.dragging::after {
    content: '⋯ Item sedang dipindah ⋯';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    z-index: 2;
    background: rgba(248, 250, 252, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Dim original content when dragging but keep it accessible */
.dragging > * {
    opacity: 0.3 !important;
    filter: grayscale(0.8);
    transition: all 0.2s ease;
}

/* Floating drag preview */
.drag-preview {
    position: fixed;
    opacity: 0.95 !important;
    transform: scale(1.05) !important;
    background: linear-gradient(145deg, #ffffff, #f8fafc) !important;
    border: 3px solid #3b82f6 !important;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.2),
        0 10px 20px rgba(59, 130, 246, 0.3) !important;
    transition: none !important;
    z-index: 9999 !important;
    border-radius: 8px !important;
    pointer-events: none;
}

.drag-over {
    background-color: #eff6ff !important;
}

/* Menu item transition effects */
.menu-transition-up {
    transform: translateY(-12px);
    transition: transform 0.25s ease;
    margin-bottom: 8px;
}

.menu-transition-down {
    transform: translateY(12px);
    transition: transform 0.25s ease;
    margin-top: 8px;
}

/* Spacing effect for items around drop zone */
.space-above {
    margin-top: 40px !important;
    transition: margin-top 0.3s ease;
}

.space-below {
    margin-bottom: 40px !important;
    transition: margin-bottom 0.3s ease;
}

/* Collapse effect for surrounding items when dragging starts */
.collapse-up {
    transform: translateY(-15px);
    transition: transform 0.3s ease;
}

.collapse-down {
    transform: translateY(15px);
    transition: transform 0.3s ease;
}

/* Enhanced drop line with more visibility */
.drop-line {
    height: 4px;
    background: #3b82f6;
    border-radius: 3px;
    margin: 20px 0;
    opacity: 0.9;
    position: relative;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
    animation: dropLinePulse 1.5s ease-in-out infinite;
}

@keyframes dropLinePulse {
    0%, 100% {
        box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
        transform: scaleX(1);
    }
    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
        transform: scaleX(1.02);
    }
}

/* Drag placeholder styles */
.drag-placeholder {
    min-height: 60px;
    border: 2px dashed #93c5fd;
    background: linear-gradient(90deg, #f0f9ff, #e0f2fe, #f0f9ff);
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
    border-radius: 6px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    font-weight: 500;
    font-size: 14px;
    opacity: 0.8;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.drag-placeholder:hover {
    background: linear-gradient(90deg, #dbeafe, #bfdbfe, #dbeafe);
    border-color: #3b82f6;
}

.drag-handle {
    color: #9ca3af;
    transition: color 0.2s ease;
}

.drag-handle:hover {
    color: #6b7280;
}

/* Submenu specific styles */
.submenu-row {
    border-left: 3px solid #e5e7eb;
}

.submenu-row:hover {
    border-left-color: #3b82f6;
    background-color: #f3f4f6 !important;
}

.submenu-container {
    position: relative;
}

.submenu-container .submenu-item-draggable {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.submenu-container .submenu-item-draggable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.submenu-container .submenu-item-draggable.dragging {
    opacity: 0.95 !important;
    transform: scale(1.05) translateY(-4px) !important;
    background: linear-gradient(145deg, #ffffff, #f8fafc) !important;
    border: 3px solid #2563eb !important;
    box-shadow:
        0 15px 35px rgba(37, 99, 235, 0.4),
        0 10px 25px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
    transition: none !important;
    z-index: 9999 !important;
    border-radius: 8px !important;
    backdrop-filter: blur(2px) !important;
}

.submenu-toggle {
    transition: all 0.2s ease;
}

.submenu-toggle:hover {
    transform: scale(1.1);
}

.submenu-toggle i {
    transition: transform 0.2s ease;
}

/* Toggle button styles */
.toggle-item-btn {
    transition: all 0.2s ease;
}

.toggle-item-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Status indicators */
.status-active {
    background-color: #10b981;
    color: white;
}

.status-inactive {
    background-color: #6b7280;
    color: white;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-indicator.active {
    background-color: #10b981;
}

.status-indicator.inactive {
    background-color: #ef4444;
}

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */

@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 50;
        box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
    }

    .admin-nav-item {
        padding: 1rem;
        font-size: 1.1rem;
    }
}

/* ===========================================
   LOGIN PAGE SPECIFIC
   =========================================== */

body.admin-login {
    background-color: transparent;
}

.dashboard-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    filter: blur(12px);
}

.login-overlay {
    position: relative;
    z-index: 10;
    background: transparent;
}

.dashboard-bg iframe {
    border: none;
    pointer-events: none;
}

.login-container {
    background: transparent;
}

.login-form-shadow {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.05);
}

.fade-in {
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.7s ease-out;
}

.fade-in.show {
    opacity: 1;
    transform: translateY(0);
}

.fade-out {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.7s ease-out;
}

.fade-out.hide {
    opacity: 0;
    transform: translateY(-8px);
}

/* ===========================================
   LOGIN FORM OVERRIDES
   =========================================== */

/* Override form input borders to use red instead of black/gray */
.login-form-shadow input[type="text"],
.login-form-shadow input[type="password"],
.login-form-shadow input[type="email"] {
    border-color: #ef4444 !important;
    border-width: 2px !important;
}

.login-form-shadow input[type="text"]:focus,
.login-form-shadow input[type="password"]:focus,
.login-form-shadow input[type="email"]:focus {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
    outline: none !important;
}

/* Remove any default Tailwind border colors */
input.border-gray-300,
.login-form-shadow input.border-gray-300 {
    border-color: #ef4444 !important;
    border-width: 2px !important;
}

input.border-gray-300:focus,
.login-form-shadow input.border-gray-300:focus {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* Handle inputs with just 'border' class */
.login-form-shadow input.border:not([class*="border-"]) {
    border-color: #ef4444 !important;
    border-width: 2px !important;
}

.login-form-shadow input.border:not([class*="border-"]):focus {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* ===========================================
   CALENDAR WIDGET STYLES
   =========================================== */

#calendar-widget {
    font-family: inherit;
}

/* Calendar day cells */
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    background-color: transparent;
    border: 1px solid transparent;
}

.calendar-day:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

/* Different day states */
.calendar-day.prev-month,
.calendar-day.next-month {
    color: #9ca3af;
    font-weight: 400;
}

.calendar-day.current-month {
    color: #374151;
}

.calendar-day.today {
    background-color: #3b82f6;
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.calendar-day.today:hover {
    background-color: #2563eb;
    transform: scale(1.05);
}

.calendar-day.selected {
    background-color: #818cf8;
    color: white;
    border-color: #6366f1;
}

.calendar-day.weekend {
    color: #dc2626;
}

.calendar-day.weekend.prev-month,
.calendar-day.weekend.next-month {
    color: #fca5a5;
}

/* Calendar navigation buttons */
#prevMonth, #nextMonth {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#prevMonth:hover, #nextMonth:hover {
    background-color: #f3f4f6;
    color: #374151;
    transform: scale(1.1);
}

/* Calendar header */
#currentMonth {
    color: #1f2937;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
}

/* Current date info */
#current-date-info {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Calendar animations */
@keyframes fadeInCalendar {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.calendar-fade-in {
    animation: fadeInCalendar 0.3s ease-out;
}

/* Calendar responsive adjustments */
@media (max-width: 1024px) {
    .calendar-day {
        font-size: 0.75rem;
        padding: 0.125rem;
    }
    
    #currentMonth {
        font-size: 1rem;
    }
}

/* Calendar month transition */
.calendar-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.calendar-slide-out {
    opacity: 0;
    transform: translateX(-20px);
}

.calendar-slide-in {
    opacity: 1;
    transform: translateX(0);
}

/* Special calendar events styling (for future use) */
.calendar-day.has-event {
    position: relative;
}

.calendar-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background-color: #f59e0b;
    border-radius: 50%;
}

.calendar-day.today.has-event::after {
    background-color: #fbbf24;
}

/* Calendar widget container */
.calendar-container {
    min-height: 320px;
}
