/**
 * Portable Authentication System - Main Stylesheet
 *
 * This file contains all the custom styles for the authentication system.
 */

:root {
    /* Main color palette */
    --primary-color: #4361ee;
    --secondary-color: #7209b7;
    --tertiary-color: #3a0ca3;
    --quaternary-color: #4cc9f0;
    
    /* Functional colors */
    --success-color: #06d6a0;
    --info-color: #4cc9f0;
    --warning-color: #f9c74f;
    --danger-color: #ef476f;
    
    /* UI colors */
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --text-color: #e0e0e0;
    --text-dark: #333333;
    --text-muted: #6c757d;
    
    /* Gradient definitions */
    --gradient-start: #4361ee;
    --gradient-end: #7209b7;
    --gradient-blue: linear-gradient(135deg, #4361ee, #3a0ca3);
    --gradient-purple: linear-gradient(135deg, #7209b7, #560bad);
    --gradient-teal: linear-gradient(135deg, #4cc9f0, #06d6a0);
    --gradient-orange: linear-gradient(135deg, #f9c74f, #f3722c);
    --gradient-pink: linear-gradient(135deg, #ef476f, #b5179e);
    
    /* Card and UI element colors */
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(255, 255, 255, 0.2);
    --card-shadow: rgba(0, 0, 0, 0.1);
    
    /* Input and button colors */
    --input-bg: rgba(255, 255, 255, 0.95);
    --input-border: rgba(67, 97, 238, 0.2);
    --input-focus: rgba(67, 97, 238, 0.4);
    --button-hover: rgba(255, 255, 255, 0.1);
}

@keyframes gradientAnimation {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(67, 97, 238, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(67, 97, 238, 0); }
    100% { box-shadow: 0 0 0 0 rgba(67, 97, 238, 0); }
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    padding-top: 70px; /* Slightly reduced top padding */
    background-color: #f0f2f5;
    background-image: linear-gradient(135deg, #f0f2f5 0%, #d7dde8 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Main content area should take up available space */
.container {
    flex: 1 0 auto;
}

/* Footer should stay at bottom */
footer {
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
}

/* Modern navbar with gradient */
.navbar {
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end)) !important;
    background-size: 200% 200% !important;
    animation: gradientAnimation 15s ease infinite;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.2);
    border: none;
    padding: 0.8rem 1rem;
}

.navbar-dark .navbar-nav .nav-link {
    color: var(--text-color);
    position: relative;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    font-weight: 500;
}

.navbar-dark .navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background: white;
    transition: all 0.3s ease;
    transform: translateX(-50%);
    opacity: 0;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: white;
    transform: translateY(-2px);
}

.navbar-dark .navbar-nav .nav-link:hover::after {
    width: 80%;
    opacity: 1;
}

.navbar-brand {
    font-weight: bold;
    background: linear-gradient(to right, #ffffff, #e0e0e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.5rem;
    letter-spacing: 0.5px;
    position: relative;
    padding-left: 0.5rem;
}

.navbar-brand::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    background: white;
    border-radius: 3px;
}

.user-info {
    color: var(--text-color);
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* User avatar styling */
.user-avatar {
    position: relative;
    cursor: pointer;
}

.user-avatar img {
    border: 2px solid rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.user-avatar:hover img {
    border-color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Custom tooltip styling */
.tooltip-content {
    text-align: left;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 2px 0;
}

.tooltip-content div {
    margin-bottom: 3px;
    white-space: nowrap;
}

.tooltip-content div:last-child {
    margin-bottom: 0;
}

/* Product items in tooltip */
.product-item {
    margin-left: 10px;
    padding-left: 5px;
    border-left: 2px solid rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
    white-space: nowrap;
}

.tooltip-inner {
    max-width: 350px;
    padding: 10px 12px;
}

/* Glass effect for cards with enhanced styling */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid var(--card-border);
    box-shadow: 0 10px 30px var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    animation: fadeIn 0.6s ease-out forwards;
    margin-bottom: 1.5rem;
}

.card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Unified card header style - dark gray */
.card-header {
    color: white;
    border-bottom: none;
    padding: 1.2rem 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 16px 16px 0 0 !important;
    background: #333333; /* Dark gray for all card headers */
}

/* Remove all the different card header styles to maintain consistency */
.card.feature .card-header,
.card.example .card-header,
.card.info .card-header,
.card.setup .card-header,
.card.auth .card-header {
    background: #333333; /* Dark gray for all card headers */
}

.card-header h4 {
    margin: 0;
    font-size: 1.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-body {
    padding: 1.8rem;
    color: var(--text-dark);
}

.card-footer {
    background: rgba(240, 242, 245, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 1.5rem;
    border-radius: 0 0 16px 16px !important;
}

/* Modern form controls with animations */
.form-control, .btn {
    border-radius: 10px;
}

.form-control {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 12px 16px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
}

.form-control:focus {
    box-shadow: 0 0 0 3px var(--input-focus);
    border-color: var(--primary-color);
    background: white;
    transform: translateY(-2px);
    outline: none;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.form-control:focus + .form-label {
    color: var(--primary-color);
}

/* Custom form elements */
.form-check-input {
    width: 1.2em;
    height: 1.2em;
    margin-top: 0.15em;
    vertical-align: top;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: 1px solid var(--input-border);
    appearance: none;
    transition: all 0.2s ease;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

/* Button styles */
.btn {
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 12px 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0.2), rgba(255,255,255,0));
    transition: all 0.6s ease;
}

.btn:hover::before {
    left: 100%;
}

/* Button variations */
.btn-primary {
    background: var(--gradient-blue);
    border: none;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
    color: white;
}

/* Back/navigation buttons */
.btn-back {
    background: #da3f3f;
    border: none;
    box-shadow: 0 4px 15px rgba(218, 63, 63, 0.3);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-back:hover {
    background: #c53636;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(218, 63, 63, 0.4);
    color: white; /* Maintain white text on hover */
}

.btn-secondary {
    background: var(--gradient-purple);
    border: none;
    box-shadow: 0 4px 15px rgba(114, 9, 183, 0.3);
    color: white;
}

/* Special button for authentication pages */
.btn-auth {
    background: #1176a4;
    border: none;
    box-shadow: 0 4px 15px rgba(17, 118, 164, 0.3);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-auth:hover {
    background: #0d5d83;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(17, 118, 164, 0.4);
    color: white; /* Maintain white text on hover */
}

/* Custom outline light button for card headers */
.btn-outline-light {
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    background: transparent;
}

.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white; /* Maintain white text on hover */
    border-color: white;
}

/* Hamburger to X transformation */
.navbar-toggler {
    border: none;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.navbar-toggler:focus {
    box-shadow: none;
    outline: none;
}

.navbar-toggler .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    transition: all 0.3s ease;
}

.navbar-toggler.is-active .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M6 6L24 24M6 24L24 6'/%3e%3c/svg%3e");
}

/* Mobile navbar styles - simplified approach */
@media (max-width: 991.98px) {
    .navbar-collapse {
        display: none; /* Hide by default */
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background-color: var(--gradient-start);
        padding: 1rem;
        z-index: 1000;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    }
    
    /* Use display instead of max-height for simpler toggling */
    .navbar-collapse.show {
        display: block;
        animation: fadeIn 0.3s ease forwards;
    }
    
    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .navbar-nav {
        padding: 1rem 0;
    }
    
    .navbar-nav .nav-item {
        margin-bottom: 0.5rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
        border-radius: 8px;
        color: white !important;
    }
    
    .navbar-nav .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

/* Submit buttons (call to action) */
.btn-submit {
    background: var(--gradient-orange);
    border: none;
    box-shadow: 0 4px 15px rgba(249, 199, 79, 0.3);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-submit::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 70%);
    opacity: 0;
    transform: scale(0.5);
    transition: transform 0.5s, opacity 0.5s;
}

.btn-submit:hover {
    color: white; /* Maintain white text on hover */
}

.btn-submit:hover::after {
    opacity: 1;
    transform: scale(1);
}

.btn-success {
    background: var(--gradient-teal);
    border: none;
    box-shadow: 0 4px 15px rgba(6, 214, 160, 0.3);
    color: white;
}

.btn-danger {
    background: var(--gradient-pink);
    border: none;
    box-shadow: 0 4px 15px rgba(239, 71, 111, 0.3);
    color: white;
}

.btn-warning {
    background: var(--gradient-orange);
    border: none;
    box-shadow: 0 4px 15px rgba(249, 199, 79, 0.3);
    color: white;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(1px);
}

/* Link button */
.btn-link {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    color: var(--primary-color);
    font-weight: 500;
    box-shadow: none;
    text-decoration: none;
}

.btn-link:hover {
    color: var(--secondary-color);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: none;
}

/* Outline button */
.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    box-shadow: none;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

/* Footer styling with gradient */
footer {
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end)) !important;
    background-size: 200% 200% !important;
    animation: gradientAnimation 15s ease infinite;
    color: var(--text-color);
    padding: 1.5rem 0;
    margin-top: 3rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

footer p {
    margin-bottom: 0;
    font-weight: 500;
}

/* Alert styling */
.alert {
    border-radius: 10px;
    border: none;
    padding: 1rem 1.25rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.5s ease-out forwards;
    font-weight: 500;
}

/* Success alert - Green */
.alert-success {
    background-color: #06d6a0;
    color: #ffffff;
    border-left: 4px solid #057a5b;
}

/* Danger/Error alert - Red */
.alert-danger {
    background-color: #ef476f;
    color: #ffffff;
    border-left: 4px solid #c01e46;
}

/* Warning alert - Yellow/Orange */
.alert-warning {
    background-color: #f9c74f;
    color: #000000; /* Dark text for light background */
    border-left: 4px solid #f3722c;
}

/* Info alert - Blue */
.alert-info {
    background-color: #4cc9f0;
    color: #ffffff;
    border-left: 4px solid #4361ee;
}

/* Toastr customization */
#toast-container > div {
    opacity: 0.95;
    border-radius: 10px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    padding: 15px 15px 15px 50px;
    font-weight: 500;
}

#toast-container > .toast-success {
    background-color: #06d6a0;
    color: #ffffff;
}

#toast-container > .toast-error {
    background-color: #ef476f;
    color: #ffffff;
}

#toast-container > .toast-warning {
    background-color: #f9c74f;
    color: #000000; /* Dark text for light background */
}

#toast-container > .toast-info {
    background-color: #4cc9f0;
    color: #ffffff;
}

/* Additional animations and effects */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    animation: pulse 1.5s infinite;
}

a {
    color: var(--primary-color);
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
}

a:hover {
    color: var(--secondary-color);
}

a:not(.btn):not(.nav-link)::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 0;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    transition: width 0.3s ease;
}

a:not(.btn):not(.nav-link):hover::after {
    width: 100%;
}