/* /home/user-data/www/default/assets/css/components.css */
/* Consolidated reusable components - removes duplications from admin.css and other files */

/* ============================================ */
/* BUTTONS - Unified for all components */
/* ============================================ */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    box-sizing: border-box;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn:focus {
    outline: 2px solid rgba(254, 202, 87, 0.7);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Button Variants */
.btn-primary {
    background: rgba(254, 202, 87, 0.3);
    border: 1px solid rgba(254, 202, 87, 0.5);
}

.btn-primary:hover:not(:disabled) {
    background: rgba(254, 202, 87, 0.5);
}

.btn-danger {
    background: rgba(255, 107, 107, 0.3);
    border: 1px solid rgba(255, 107, 107, 0.5);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(255, 107, 107, 0.5);
}

.btn-warning {
    background: rgba(255, 193, 7, 0.3);
    border: 1px solid rgba(255, 193, 7, 0.5);
}

.btn-warning:hover:not(:disabled) {
    background: rgba(255, 193, 7, 0.5);
}

.btn-secondary {
    background: rgba(108, 117, 125, 0.3);
    border: 1px solid rgba(108, 117, 125, 0.5);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(108, 117, 125, 0.5);
}

.btn-success {
    background: rgba(76, 175, 80, 0.3);
    border: 1px solid rgba(76, 175, 80, 0.5);
}

.btn-success:hover:not(:disabled) {
    background: rgba(76, 175, 80, 0.5);
}

/* Button Sizes */
.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ============================================ */
/* FORMS - Unified for all components */
/* ============================================ */

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgba(254, 202, 87, 0.7);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(254, 202, 87, 0.2);
}

.form-group select option {
    background: #2d3748;
    color: white;
}

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

/* Form layouts */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.form-actions.center {
    justify-content: center;
}

.form-actions.end {
    justify-content: flex-end;
}

/* Form validation states */
.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: rgba(255, 107, 107, 0.7);
    background: rgba(255, 107, 107, 0.1);
}

.form-group.success input,
.form-group.success select,
.form-group.success textarea {
    border-color: rgba(76, 175, 80, 0.7);
    background: rgba(76, 175, 80, 0.1);
}

.form-error {
    color: #ff6b6b;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* ============================================ */
/* MESSAGES - Unified for all components */
/* ============================================ */

.error-message,
.success-message {
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 1;
    transform: translateY(0);
}

.error-message {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: white;
}

.success-message {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.4);
    color: white;
}

.error-message.fade-out,
.success-message.fade-out {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* ============================================ */
/* SEARCH BOX */
/* ============================================ */

.search-container {
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.search-box:hover,
.search-box:focus-within {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.search-box input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: white;
    font-size: 1rem;
    outline: none;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-box button {
    padding: 12px 20px;
    border: none;
    background: rgba(254, 202, 87, 0.2);
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.search-box button:hover {
    background: rgba(254, 202, 87, 0.3);
    transform: scale(1.05);
}

/* ============================================ */
/* STATUS INDICATORS */
/* ============================================ */

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-online {
    background-color: #4CAF50;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
}

.status-offline {
    background-color: #f44336;
    box-shadow: 0 0 6px rgba(244, 67, 54, 0.6);
}

.status-warning {
    background-color: #ff9800;
    box-shadow: 0 0 6px rgba(255, 152, 0, 0.6);
}

/* ============================================ */
/* MODALS - Unified modal system */
/* ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h3,
.modal-content h4 {
    margin-bottom: 1rem;
    color: white;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.modal-close:hover {
    opacity: 1;
}

/* ============================================ */
/* SETTINGS ICON & MODAL */
/* ============================================ */

.settings-icon {
    position: fixed !important;
    bottom: 4.5rem !important; /* Positioned above the theme toggle */
    right: 1.5rem !important; /* Aligned with theme toggle */
    z-index: 998; /* Below theme toggle but above other content */
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    color: white;
}

.settings-icon:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px) rotate(30deg);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.settings-modal.active {
    display: flex;
}

.settings-modal-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-header h3 {
    margin: 0;
    color: white;
    font-size: 1.4rem;
}

.settings-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    border-bottom: 3px solid transparent;
}

.settings-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.settings-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: #feca57;
    border-bottom-color: #feca57;
}

.settings-content {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

.settings-section {
    margin-bottom: 2rem;
}

.settings-section h4 {
    color: white;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.settings-description {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.help-actions {
    margin-bottom: 2rem;
}

.help-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.help-info h5 {
    color: #feca57;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.help-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-info li {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    position: relative;
    padding-left: 1.2rem;
}

.help-info li::before {
    content: '💡';
    position: absolute;
    left: 0;
    top: 0;
}

/* ============================================ */
/* HELP MODAL */
/* ============================================ */

.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200; /* Above settings modal */
}

.help-modal.active {
    display: flex;
}

.help-modal-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.help-header h3 {
    margin: 0;
    color: white;
    font-size: 1.3rem;
}

.help-modal-content form {
    padding: 2rem;
}

.help-modal-content .form-group {
    margin-bottom: 1.5rem;
}

.help-modal-content textarea {
    min-height: 120px;
}

/* ============================================ */
/* LOADING STATES */
/* ============================================ */

.loading-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

.loading-container {
    text-align: center;
    padding: 2rem;
}

.loading-content {
    margin-top: 2rem;
}

.loading-spinner-large {
    font-size: 4rem;
    animation: pulse 2s ease-in-out infinite;
    margin-bottom: 1rem;
}

.loading-content p {
    font-size: 1.1rem;
    opacity: 0.8;
    margin: 0;
}

/* ============================================ */
/* THEME TOGGLE - BASE STYLES (LIGHT MODE) */
/* ============================================ */

.theme-toggle {
    position: fixed !important;
    bottom: 1.5rem !important;
    right: 1.5rem !important;
    top: auto !important;
    left: auto !important;
    z-index: 999; /* Below modals (1000) but above other content */
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 0.25rem;
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

.theme-icon {
    font-size: 1rem;
    padding: 0.25rem;
    user-select: none;
}

.theme-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: 0.4s;
    border-radius: 34px;
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .theme-slider {
    background-color: #feca57;
}

input:checked + .theme-slider:before {
    transform: translateX(24px);
}

/* ============================================ */
/* UTILITY CLASSES */
/* ============================================ */

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.fade-out {
    animation: fadeOut 0.3s ease-in-out;
}

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

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.icon {
    font-size: 1rem;
}

/* ============================================ */
/* RESPONSIVE ADJUSTMENTS */
/* ============================================ */

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        justify-content: center;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }

    .search-box {
        max-width: 100%;
        margin: 0 1rem;
    }

    .search-box input,
    .search-box button {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }

    /* Settings responsive */
    .settings-icon {
        bottom: 3.5rem !important; /* Adjusted for mobile */
        right: 1rem !important; /* Aligned with mobile theme toggle */
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .settings-modal-content {
        margin: 1rem;
    }

    .settings-header,
    .settings-content,
    .help-modal-content form {
        padding: 1.5rem;
    }

    .settings-tabs {
        flex-direction: column;
    }

    .settings-tab {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        border-right: 3px solid transparent;
    }

    .settings-tab.active {
        border-bottom-color: rgba(255, 255, 255, 0.1);
        border-right-color: #feca57;
    }

    /* Theme toggle responsive */
    .theme-toggle {
        bottom: 1rem !important;
        right: 1rem !important;
        padding: 0.2rem;
        gap: 0.3rem;
    }

    .theme-icon {
        font-size: 0.9rem;
    }

    .theme-switch {
        width: 40px;
        height: 22px;
    }

    .theme-slider:before {
        height: 16px;
        width: 16px;
    }

    input:checked + .theme-slider:before {
        transform: translateX(18px);
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .btn-small {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .search-box {
        margin: 0 0.5rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    /* Settings responsive */
    .settings-icon {
        bottom: 3.25rem !important; /* Adjusted for smaller screens */
        right: 0.75rem !important; /* Aligned with smaller screen theme toggle */
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .settings-modal-content,
    .help-modal-content {
        margin: 0.5rem;
    }

    /* Theme toggle responsive */
    .theme-toggle {
        bottom: 0.75rem !important;
        right: 0.75rem !important;
    }
}

@media (max-width: 320px) {
    .settings-icon {
        bottom: 3rem !important; /* Adjusted for very small screens */
        right: 0.5rem !important; /* Aligned with very small screen theme toggle */
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }

    .theme-toggle {
        bottom: 0.5rem !important;
        right: 0.5rem !important;
        transform: scale(0.9);
    }

    .theme-toggle:hover {
        transform: scale(0.9) translateY(-2px);
    }
}
