/* Loading Screen Styles */

/* Full Page Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

/* Spinner Styles */
.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border-width: 2px;
    margin: 0;
}

.spinner-medium {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pulse Animation */
.loading-pulse {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
    margin: 0 auto 1.5rem;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
}

/* Dots Animation */
.loading-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto 1.5rem;
}

.loading-dot {
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: dotBounce 1.4s infinite ease-in-out;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Loading Text */
.loading-text {
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.loading-subtext {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Loading Tips */
.loading-tip {
    margin-top: 2rem;
    padding: 1rem 1.5rem;
    background: rgba(219, 138, 112, 0.1);
    border-radius: 8px;
    color: var(--text-dark);
    font-size: 0.9rem;
    max-width: 320px;
    line-height: 1.5;
    animation: fadeInUp 0.5s ease-out 0.3s both;
}

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

/* Mobile loading adjustments */
@media (max-width: 768px) {
    .loading-content {
        padding: 1rem;
        max-width: 90vw;
    }
    
    .spinner {
        width: 50px;
        height: 50px;
    }
    
    .loading-text {
        font-size: 1rem;
    }
    
    .loading-tip {
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
        max-width: 280px;
    }
}

/* Inline Loading */
.inline-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
}

/* Button Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    color: white;
}

.btn-secondary.btn-loading::after {
    color: var(--text-dark);
}

/* Section Loading (for content areas) */
.section-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    min-height: 300px;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-card {
    height: 200px;
    border-radius: 8px;
}

/* Progress Bar Loading */
.loading-progress {
    width: 200px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin: 1rem auto 0;
}

.loading-progress-bar {
    height: 100%;
    background: var(--primary-color);
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 0%;
        margin-left: 0;
    }
    50% {
        width: 50%;
        margin-left: 25%;
    }
    100% {
        width: 0%;
        margin-left: 100%;
    }
}

/* Logo Animation for Brand Loading */
.loading-logo {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    animation: logoFloat 2s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Fade In Content */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Success Animation */
.loading-success {
    color: var(--success);
    font-size: 3rem;
    animation: successPop 0.5s ease-out;
}

@keyframes successPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Connection & Command Palette Enhancements */
.offline-indicator {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1.1rem;
    border-radius: 999px;
    background: rgba(26, 32, 44, 0.96);
    color: #f7fafc;
    font-size: 0.9rem;
    box-shadow: 0 22px 45px rgba(15, 23, 42, 0.25);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    z-index: 11000;
}

.offline-indicator i {
    font-size: 1rem;
}

.offline-indicator .offline-shortcut {
    font-size: 0.75rem;
    opacity: 0.75;
}

.offline-indicator.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.offline-indicator.restored {
    background: rgba(56, 161, 105, 0.95);
}

body.app-offline .offline-indicator {
    background: rgba(197, 48, 48, 0.95);
}

body.quick-command-open {
    overflow: hidden;
}

.quick-command-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 11000;
}

.quick-command-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.quick-command-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.quick-command-panel {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    width: min(520px, calc(100% - 2rem));
    box-shadow: 0 35px 60px rgba(15, 23, 42, 0.25);
    transform: translateY(8px);
    transition: transform 0.25s ease;
}

.quick-command-overlay.active .quick-command-panel {
    transform: translateY(0);
}

.quick-command-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.quick-command-title {
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-dark);
}

.quick-command-title i {
    color: var(--primary-color);
}

.quick-command-close {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
}

.quick-command-close:hover,
.quick-command-close:focus-visible {
    background: rgba(226, 232, 240, 0.6);
    color: var(--text-dark);
}

.quick-command-body {
    padding: 0.75rem 1.25rem 1.25rem;
}

.quick-command-hint {
    margin-bottom: 0.75rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

.quick-command-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quick-command-item {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #ffffff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.quick-command-item:hover,
.quick-command-item:focus-visible {
    border-color: var(--primary-color);
    box-shadow: 0 12px 24px rgba(219, 138, 112, 0.18);
    transform: translateY(-1px);
}

.quick-command-key {
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(219, 138, 112, 0.12);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    justify-self: flex-start;
}

.quick-command-content {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-dark);
    font-weight: 600;
}

.quick-command-content i {
    color: var(--primary-color);
}

.quick-command-description {
    grid-column: 2 / 3;
    font-size: 0.78rem;
    color: var(--text-light);
}

.quick-command-footer {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: right;
}

.quick-command-footer kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #edf2f7;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    padding: 0.15rem 0.4rem;
    margin: 0 0.15rem;
    font-size: 0.75rem;
    font-family: 'Inter', 'Open Sans', sans-serif;
    color: #2d3748;
    min-width: 1.4rem;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .offline-indicator {
        left: 0.75rem;
        right: 0.75rem;
        bottom: 1rem;
        font-size: 0.85rem;
        justify-content: center;
        text-align: center;
        flex-wrap: wrap;
    }
    .offline-indicator .offline-shortcut {
        width: 100%;
        text-align: center;
        margin-top: 0.25rem;
    }
    .quick-command-panel {
        width: calc(100% - 1.5rem);
    }
    .quick-command-list {
        gap: 0.4rem;
    }
    .quick-command-item {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
    .quick-command-key {
        justify-self: flex-start;
    }
    .quick-command-description {
        grid-column: 1 / -1;
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .spinner {
        width: 50px;
        height: 50px;
    }
    
    .loading-text {
        font-size: 1rem;
    }
    
    .loading-subtext {
        font-size: 0.85rem;
    }
}
