/**
 * Custom Styles for IPTV Client Auth Module
 * Enhances Bootstrap 5 with custom styling and responsive design
 */

/* Body and Layout */
html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout wrapper for logged in users */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

/* Override background for main content area */
main.container {
    background: transparent;
}

/* Card Enhancements */
.card {
    border: none;
    border-radius: 15px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.card-header {
    border-bottom: none;
    padding: 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 2rem;
}

.card-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(248, 249, 250, 0.8);
}

/* Form Enhancements */
.form-control {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* Button Enhancements */
.btn {
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(45deg, #28a745, #20c997);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.btn-warning {
    background: linear-gradient(45deg, #ffc107, #fd7e14);
    color: #212529;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
    color: #212529;
}

.btn-info {
    background: linear-gradient(45deg, #17a2b8, #6f42c1);
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.4);
}

.btn-outline-danger {
    border: 2px solid #dc3545;
    color: #dc3545;
}

.btn-outline-danger:hover {
    background: #dc3545;
    border-color: #dc3545;
    transform: translateY(-2px);
}

/* Navbar Enhancements */
.navbar {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    background: rgba(0, 123, 255, 0.9) !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

/* Alert Enhancements */
.alert {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background: linear-gradient(45deg, #d4edda, #c3e6cb);
    color: #155724;
}

.alert-danger {
    background: linear-gradient(45deg, #f8d7da, #f5c6cb);
    color: #721c24;
}

.alert-warning {
    background: linear-gradient(45deg, #fff3cd, #ffeaa7);
    color: #856404;
}

.alert-info {
    background: linear-gradient(45deg, #d1ecf1, #bee5eb);
    color: #0c5460;
}

/* Fixed Sidebar Layout */
.sidebar-fixed {
    position: fixed;
    top: 56px; /* Height of navbar */
    left: 0;
    width: 280px;
    height: calc(100vh - 56px);
    z-index: 1040;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.main-content {
    margin-left: 280px;
    padding: 20px;
    transition: margin-left 0.3s ease;
}

/* Sidebar Navigation Styles */
.sidebar-fixed .nav-link {
    color: #495057;
    padding: 12px 20px;
    border-radius: 0;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.sidebar-fixed .nav-link:hover {
    background-color: #f8f9fa;
    color: #667eea;
    padding-left: 25px;
}

.sidebar-fixed .nav-link.active {
    background-color: #667eea;
    color: white;
    font-weight: 500;
}

.sidebar-fixed .nav-link i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Sidebar Header (Mobile Only) */
.sidebar-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1039;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile Responsive Adjustments */
@media (max-width: 991.98px) {
    .sidebar-fixed {
        transform: translateX(-100%);
        z-index: 1041;
    }
    
    .sidebar-fixed.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .has-sidebar .main-content {
        margin-left: 0;
    }
}

/* Desktop - Always show sidebar */
@media (min-width: 992px) {
    .sidebar-fixed {
        transform: translateX(0) !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
    
    .sidebar-header {
        display: none !important;
    }
}

/* Footer Enhancements */
footer {
    background: rgba(52, 58, 64, 0.95) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
    margin-top: auto;
    margin-left: 280px; /* Account for fixed sidebar */
    transition: margin-left 0.3s ease;
}

/* Footer for non-logged in users */
body:not(.has-sidebar) footer {
    margin-left: 0;
}

/* Footer responsive adjustments */
@media (max-width: 991.98px) {
    footer {
        margin-left: 0 !important;
    }
}

/* Form Check Enhancements */
.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.form-check-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.25);
}

/* Icon Enhancements */
.display-1 {
    font-size: 4rem;
    opacity: 0.8;
}

/* Link Enhancements */
.btn-link {
    color: #667eea;
    text-decoration: none;
}

.btn-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .card-body {
        padding: 1.5rem;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .display-1 {
        font-size: 3rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
}

/* Sidebar Toggle Button Styles */
#sidebarToggle {
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    transition: all 0.3s ease;
}

#sidebarToggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: white;
}

/* Ensure sidebar is always accessible */
.sidebar-fixed {
    will-change: transform;
}

/* Smooth scrolling for sidebar */
.sidebar-fixed {
    scroll-behavior: smooth;
}

/* Better mobile touch targets */
@media (max-width: 991.98px) {
    .sidebar-fixed .nav-link {
        padding: 15px 20px;
        font-size: 1rem;
    }
    
    .sidebar-fixed .nav-link i {
        width: 24px;
        font-size: 1.1rem;
    }
}

/* Animation for page load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

/* Loading state for forms */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Focus indicators for accessibility */
.form-control:focus,
.btn:focus,
.form-check-input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #764ba2, #667eea);
}
