/* Dark/Light Mode Variables */
:root {
    /* Light Mode Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-primary: #2c3e50;
    --text-secondary: #555;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --button-primary: linear-gradient(135deg, #3498db, #2980b9);
    --button-secondary: #f8f9fa;
    --button-secondary-hover: #e9ecef;
    --button-text: white;
    --button-secondary-text: #6c757d;
    --input-bg: #f8f9fa;
    --input-border: #e9ecef;
    --input-focus: #3498db;
    --progress-bg: #e9ecef;
    --toast-bg: white;
    --toast-border: #3498db;
}

[data-theme="dark"] {
    /* Dark Mode Colors */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    --bg-gradient: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #888;
    --border-color: #404040;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --success-color: #27ae60;
    --error-color: #c0392b;
    --warning-color: #d35400;
    --info-color: #2980b9;
    --button-primary: linear-gradient(135deg, #2980b9, #1f618d);
    --button-secondary: #404040;
    --button-secondary-hover: #505050;
    --button-text: white;
    --button-secondary-text: #b0b0b0;
    --input-bg: #2d2d2d;
    --input-border: #404040;
    --input-focus: #3498db;
    --progress-bg: #404040;
    --toast-bg: #2d2d2d;
    --toast-border: #3498db;
}

/* Main Dialog Styles */
.brite-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(5px);
}

.brite-dialog-overlay.active {
    opacity: 1;
    visibility: visible;
}

.brite-dialog {
    background-color: var(--bg-primary);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px var(--shadow-color);
    transform: scale(0.7) translateY(-50px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    overflow: hidden;
    position: relative;
    z-index: 10001;
    border: 1px solid var(--border-color);
}

.brite-dialog-overlay.active .brite-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.brite-dialog-header {
    padding: 25px 25px 0;
    display: flex;
    align-items: center;
    position: relative;
}

.brite-dialog-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 20px;
    flex-shrink: 0;
    position: relative;
    animation: brite-iconPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s both;
}

.brite-dialog-icon.success {
    background: linear-gradient(135deg, var(--success-color), #27ae60);
    color: white;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
}

.brite-dialog-icon.error {
    background: linear-gradient(135deg, var(--error-color), #c0392b);
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.brite-dialog-icon.warning {
    background: linear-gradient(135deg, var(--warning-color), #d35400);
    color: white;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
}

.brite-dialog-icon.info {
    background: linear-gradient(135deg, var(--info-color), #2980b9);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.brite-dialog-icon svg {
    width: 30px;
    height: 30px;
}

.brite-dialog-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    animation: brite-fadeInUp 0.5s ease 0.3s both;
}

.brite-dialog-body {
    padding: 25px;
    animation: brite-fadeInUp 0.5s ease 0.4s both;
}

.brite-dialog-message {
    margin-bottom: 25px;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1.1rem;
    white-space: pre-line;
}

.brite-dialog-html {
    margin-bottom: 25px;
    color: var(--text-secondary);
}

.brite-dialog-footer {
    padding: 0 25px 25px;
    display: flex;
    gap: 12px;
    animation: brite-fadeInUp 0.5s ease 0.5s both;
    justify-content: center;
    flex-wrap: wrap;
}

.brite-dialog-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-width: 120px;
}

@media (max-width: 600px) {
    .brite-dialog-footer {
        flex-direction: row !important;
    }

    .brite-dialog-btn {
        width: 48%;
        min-width: unset;
    }
}

.brite-dialog-btn:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.brite-dialog-btn:focus:not(:active)::after {
    animation: brite-ripple 1s ease-out;
}

.brite-dialog-btn.confirm {
    background: var(--button-primary);
    color: var(--button-text);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.brite-dialog-btn.confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.brite-dialog-btn.cancel {
    background: var(--button-secondary);
    color: var(--button-secondary-text);
    border: 2px solid var(--border-color);
}

.brite-dialog-btn.cancel:hover {
    background: var(--button-secondary-hover);
    transform: translateY(-2px);
}

.brite-dialog-progress-container {
    padding: 20px 25px 0;
}

.brite-dialog-progress {
    height: 6px;
    background-color: var(--progress-bg);
    width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 3px;
}

.brite-dialog-progress-bar {
    height: 100%;
    background: var(--button-primary);
    width: 100%;
    transition: width 0.1s linear;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

.brite-dialog-progress-bar:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    z-index: 1;
    background-size: 50px 50px;
    animation: brite-move 2s linear infinite;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
}

.brite-dialog-timer-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 8px;
    animation: brite-fadeIn 0.5s ease 0.6s both;
}

/* Loading Dialog Styles */
.brite-dialog-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10002;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(5px);
}

.brite-dialog-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.brite-dialog-loading {
    background-color: var(--bg-primary);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px var(--shadow-color);
    transform: scale(0.7) translateY(-50px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    overflow: hidden;
    position: relative;
    z-index: 10003;
    border: 1px solid var(--border-color);
    padding: 30px;
    text-align: center;
}

.brite-dialog-loading-overlay.active .brite-dialog-loading {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.brite-dialog-loading-header {
    margin-bottom: 20px;
}

.brite-dialog-loading-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    background: var(--info-color);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    animation: brite-pulse 2s infinite;
}

.brite-dialog-loading-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.brite-dialog-loading-body {
    color: var(--text-secondary);
}

.brite-dialog-loading-message {
    line-height: 1.6;
    font-size: 1rem;
}

/* Toast Styles */
.brite-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10010;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.brite-toast {
    background: var(--toast-bg);
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 10px 30px var(--shadow-color);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid var(--toast-border);
    color: var(--text-primary);
}

.brite-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.brite-toast.hide {
    transform: translateX(400px);
    opacity: 0;
}

.brite-toast.success {
    border-left-color: var(--success-color);
}

.brite-toast.error {
    border-left-color: var(--error-color);
}

.brite-toast.warning {
    border-left-color: var(--warning-color);
}

.brite-toast.info {
    border-left-color: var(--info-color);
}

.brite-toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.brite-toast-content {
    flex: 1;
}

.brite-toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    font-size: 1rem;
}

.brite-toast-message {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

.brite-toast-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.brite-toast-close:hover {
    background: var(--button-secondary);
    color: var(--text-primary);
}

/* OTP Input Styles */
.brite-otp-container {
    display: flex;
    justify-content: space-between;
    margin: 25px 0;
    gap: 10px;
}

.brite-otp-input {
    width: 50px;
    height: 50px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    transition: all 0.3s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}

.brite-otp-input:focus {
    border-color: var(--input-focus);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    outline: none;
    transform: scale(1.05);
}

.brite-otp-input.filled {
    border-color: var(--input-focus);
    background: var(--bg-primary);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

/* Loading Spinner */
.brite-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid transparent;
    border-top: 4px solid currentColor;
    border-radius: 50%;
    animation: brite-spin 1s linear infinite;
}

/* Animations */
@keyframes brite-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes brite-pulse {
    0% {
        box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(52, 152, 219, 0.6);
    }
    100% {
        box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    }
}

@keyframes brite-iconPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes brite-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes brite-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes brite-ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

@keyframes brite-move {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .brite-dialog,
    .brite-dialog-loading {
        width: 95%;
        margin: 20px;
    }
    
    .brite-dialog-footer {
        flex-direction: column;
    }
    
    .brite-otp-input {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .brite-toast-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .brite-dialog-header {
        padding: 20px 20px 0;
        flex-direction: column;
        text-align: center;
    }
    
    .brite-dialog-icon {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .brite-otp-input {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .brite-toast {
        padding: 12px 16px;
    }
}