/**
 * Shared UI Components Styling
 * Universal styles for sidebar, floating buttons, and common UI elements
 */

/* Import mobile header styles */
@import url('mobile-header-styles.css');

/* ===== SIDEBAR NAVIGATION ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateX(0); /* Visible by default */
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar.open {
    transform: translateX(0);
}

/* Mobile: Hide sidebar by default, show only when .open class is added */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%) !important;
        top: 60px;
        height: calc(100vh - 60px);
        z-index: 1000; /* Higher than overlay to prevent blur effect */
    }
    
    .sidebar.open {
        transform: translateX(0) !important;
    }
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: #ffd700;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex: 1;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border-right: 3px solid #ffd700;
}

.nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 1.5rem;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    line-height: 1.2;
}

.user-plan {
    font-size: 0.75rem;
    opacity: 0.7;
}

.btn-logout {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-logout:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

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

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

/* ===== FLOATING ACTION HUB ===== */
.floating-buttons {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.floating-hub__toggle {
    width: 54px;
    height: 54px;
    border: none;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffd700 0%, #ff9f1c 100%);
    color: #2d1b4e;
    font-size: 1.35rem;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 16px 28px rgba(255, 159, 28, 0.35);
}

.floating-hub__toggle.active,
.floating-hub__toggle:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 20px 36px rgba(255, 159, 28, 0.45);
}

.floating-hub__toggle:focus-visible {
    outline: 3px solid rgba(255, 231, 94, 0.7);
    outline-offset: 2px;
}

.floating-hub__panel {
    position: absolute;
    bottom: 0;
    right: 76px;
    width: 320px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.92) 0%, rgba(118, 75, 162, 0.94) 100%);
    border-radius: 20px;
    padding: 1.1rem 1.2rem;
    box-shadow: 0 24px 48px rgba(40, 44, 63, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(14px);
    color: white;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px) scale(0.98);
    transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.floating-hub__panel.floating-hub__panel--open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    box-shadow: 0 28px 54px rgba(40, 44, 63, 0.32);
}

.floating-hub__header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.floating-hub__title {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.floating-hub__label {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.floating-hub__subtitle {
    font-size: 0.78rem;
    opacity: 0.85;
}

.floating-hub__support {
    margin-left: auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.floating-hub__support:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.floating-hub__menu {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 1rem;
}

.floating-hub__menu.hidden {
    display: none;
}

.floating-hub__action {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    text-decoration: none;
    color: white;
    transition: transform 0.25s ease, background 0.25s ease, border 0.25s ease;
}

.floating-hub__action:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.28);
}

.floating-hub__action-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.floating-hub__action-copy {
    display: flex;
    flex-direction: column;
}

.floating-hub__action-title {
    font-weight: 600;
    font-size: 0.93rem;
}

.floating-hub__action-meta {
    font-size: 0.75rem;
    opacity: 0.82;
}

.floating-hub__install {
    margin-top: 1rem;
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 0.65rem 0.75rem;
    background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%);
    color: white;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    box-shadow: 0 16px 32px rgba(17, 153, 142, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-hub__install i {
    font-size: 1rem;
}

.floating-hub__install:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 34px rgba(17, 153, 142, 0.45);
}

.floating-hub__install.hidden {
    display: none;
}

@media (max-width: 1024px) {
    .floating-hub__panel {
        width: 300px;
    }
}

@media (max-width: 768px) {
    .floating-buttons {
        right: 1.5rem;
        left: 1.5rem;
        bottom: 1.5rem;
    }

    .floating-hub__panel {
        right: 72px;
        width: min(320px, calc(100vw - 120px));
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .floating-buttons {
        bottom: 1.25rem;
        right: 1rem;
    }

    .floating-hub__panel {
        right: 68px;
        padding: 0.9rem;
    }

    .floating-hub__toggle {
        width: 48px;
        height: 48px;
    }
}

/* ===== MODAL COMPONENTS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(1);
    transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal-content {
    transform: scale(0.9);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 0;
}

.modal-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

/* ===== FORM COMPONENTS ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: normal !important;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.checkmark {
    font-size: 0.9rem;
    color: #666;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e1e5e9;
}

.btn-secondary:hover {
    background: #e9ecef;
    color: #333;
}

/* ===== NOTIFICATION SYSTEM ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    z-index: 1200;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-success {
    border-left: 4px solid #28a745;
}

.notification-error {
    border-left: 4px solid #dc3545;
}

.notification-info {
    border-left: 4px solid #17a2b8;
}

.notification i {
    font-size: 1.25rem;
}

.notification-success i {
    color: #28a745;
}

.notification-error i {
    color: #dc3545;
}

.notification-info i {
    color: #17a2b8;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0);
        position: relative;
        height: 100vh;
        min-height: 100vh;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .sidebar-overlay {
        display: none;
    }
    
    /* Main content layout handled by Flexbox in individual page styles */
}

@media (max-width: 768px) {
    .floating-buttons {
        bottom: 1rem;
        right: 1rem;
    }
    
    .floating-btn {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }
    
    .quick-action-menu {
        bottom: 58px;
    }
    
    .quick-action-link {
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
    }
    
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    .modal-header {
        padding: 1rem 1rem 0;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .notification {
        left: 10px;
        right: 10px;
        min-width: auto;
        transform: translateY(-100%);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }
    
    .floating-buttons {
        bottom: 0.75rem;
        right: 0.75rem;
    }
    
    .floating-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .floating-btn,
    .modal-content,
    .notification,
    .quick-action-menu {
        transition: none;
    }
}

/* Focus styles for keyboard navigation */
.sidebar-toggle:focus,
.nav-link:focus,
.btn-logout:focus,
.floating-btn:focus,
.quick-action-link:focus,
.modal-close:focus,
.btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .sidebar {
        border-right: 2px solid;
    }
    
    .floating-btn {
        border: 2px solid;
    }
    
    .modal-content {
        border: 2px solid;
    }
}

/* Offline Mode Styles */
.offline-sidebar {
    opacity: 0.8;
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.offline-notice {
    text-align: center;
    padding: 2rem 1rem;
    color: rgba(255, 255, 255, 0.7);
}

.offline-notice i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.offline-notice p {
    margin: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.offline-mode .voices-main {
    /* No need for margin-left since we're using flex layout */
    flex: 1;
}
