/* static/components.css
   Reusable UI components - buttons, forms, modals, etc.
   Extracted from style.css for better maintainability
*/

/* ===== COMPONENT BASE CLASSES ===== */

/* Button base styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: 500;
    transition: all var(--transition-base);
    text-decoration: none;
    user-select: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: var(--space-xl) var(--space-xxxl);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
    padding: var(--space-xl) var(--space-xxxl);
}

.btn-success:hover:not(:disabled) {
    background-color: var(--success-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--light-panel-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: var(--space-lg) var(--space-xxxl);
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--border-radius-md);
}

.btn-icon-lg {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-full);
}

/* Input base styles */
.input {
    padding: var(--space-md);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-base);
    transition: border-color var(--transition-base);
}

.input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* Panel base styles */
.panel {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: var(--space-lg);
}

.panel-dark {
    background-color: var(--dark-panel-bg);
}

.panel-transparent {
    background: rgba(42, 42, 42, 0.9);
    backdrop-filter: blur(5px);
}

/* Icon styles */
.icon {
    font-size: 20px;
    vertical-align: middle;
    transition: color var(--transition-base);
}

.material-symbols-outlined {
    font-size: 20px;
    vertical-align: middle;
}

/* ===== UNIFIED BUTTON STYLES ===== */

/* Base button styles - applies to all toolbar buttons */
.header-icon {
    color: var(--icon-color);
    text-decoration: none;
    transition: color var(--transition-base), transform var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    max-width: 38px;
    max-height: 38px;
    border-radius: var(--border-radius-lg);
    background-color: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.03);
    flex-shrink: 0;
    box-sizing: border-box;
}

/* Logo exception - no background or border */
.header-logo {
    font-size: var(--font-size-xxl);
    font-weight: bold;
    color: var(--icon-color);
    text-decoration: none;
    transition: color var(--transition-base), transform var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 var(--space-md);
    border-radius: var(--border-radius-md);
    background-color: transparent !important;
    border: none !important;
}

/* Unified Material Symbols styling for all toolbar icons */
.header-icon .material-symbols-outlined {
    font-size: 22px; /* 2px larger than base 20px for better visibility in toolbar buttons */
    transition: color var(--transition-base);
    color: var(--icon-color);
}

/* Movement buttons styling - similar to header-icon but with transparent background */
.move-button {
    color: var(--icon-color);
    text-decoration: none;
    transition: color var(--transition-base), transform var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    max-width: 38px;
    max-height: 38px;
    border-radius: var(--border-radius-lg);
    background-color: rgba(224, 224, 224, 0.2);
    border: 1px solid rgba(255,255,255,0.03);
    flex-shrink: 0;
    box-sizing: border-box;
}

.move-button .material-symbols-outlined {
    font-size: 22px;
    transition: color var(--transition-base);
    color: var(--icon-color);
}

.move-button:hover {
    transform: translateY(-1px);
}

/* Unified hover states for all toolbar icons */
.header-logo:hover,
.header-icon:not(.disabled):not([aria-disabled="true"]):hover{
    transform: translateY(-1px);
}

.header-logo:hover {
    color: var(--accent-color);
}

.header-icon:not(.disabled):not([aria-disabled="true"]):hover .material-symbols-outlined {
    color: var(--accent-color);
}

.header-icon:not(.disabled):not([aria-disabled="true"]):hover {
    border-color: var(--accent-color);
}

/* Unified active states for all toolbar icons */
.header-icon.active .material-symbols-outlined {
    color: var(--accent-color);
}

/* Hover and active should show the same visual treatment (accent color + lift).
   When the .active class is removed the effect will disappear immediately. */
.header-icon:not(.disabled):not([aria-disabled="true"]):hover .material-symbols-outlined,
.header-icon.active .material-symbols-outlined {
    color: var(--accent-color);
}

/* Hover and active: no border, subtle brightening of the background and slight lift */
.header-icon:not(.disabled):not([aria-disabled="true"]):hover,
.header-icon.active {
    transform: translateY(-1px);
    background-color: rgba(255,255,255,0.06);
    border-color: transparent;
}

/* Specific active states for view buttons */
.header-icon.world-view-btn.active,
.header-icon.work-view-btn.active {
    transform: translateY(-1px);
}

.header-icon.world-view-btn.active .material-symbols-outlined,
.header-icon.work-view-btn.active .material-symbols-outlined {
    color: var(--accent-color) !important;
}

/* Keep the world-view button aligned with other buttons */
.perimeter-bottom .header-icon.world-view-btn {
    margin-right: 0;
}

/* Vertical toolbar */
.vertical-toolbar {
    flex-direction: column;
    padding: var(--space-lg) 0;
    gap: var(--space-md);
    align-items: center;
}

.v-toolbar-spacer {
    flex-grow: 1;
}

/* World-only icons */
.header-icon.world-only {
    display: none;
}

.game-container:not(.work-view-active) .header-icon.world-only {
    display: flex;
}

/* ===== MODALS & OVERLAYS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

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

.modal {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    max-width: 500px;
    max-height: 80vh;
    width: 90vw;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: var(--space-xxxl);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--dark-panel-bg);
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--icon-color);
    cursor: pointer;
    font-size: 24px;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--light-panel-bg);
    color: var(--icon-hover);
}

.modal-body {
    padding: var(--space-xxxl);
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    padding: var(--space-xxxl);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-lg);
    background: var(--dark-panel-bg);
}

/* ===== FORM COMPONENTS ===== */
.form-group {
    margin-bottom: var(--space-xxxl);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-color);
    font-size: var(--font-size-sm);
}

.form-control {
    width: 100%;
    padding: var(--space-lg);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-color);
    font-size: var(--font-size-md);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(126, 173, 247, 0.1);
}

.form-control:disabled {
    background: var(--dark-panel-bg);
    color: var(--disabled-color);
    cursor: not-allowed;
}

.form-text {
    font-size: var(--font-size-xs);
    color: var(--muted-text);
    margin-top: var(--space-xs);
}

.form-error {
    color: var(--error-color);
    font-size: var(--font-size-xs);
    margin-top: var(--space-xs);
}

.form-row {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-xxxl);
}

.form-col {
    flex: 1;
}

/* ===== SLIDER TOGGLE SWITCH STYLES ===== */
.settings-section {
    margin: 20px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item span {
    color: var(--text-color);
    font-size: 14px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-color);
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* ===== ADDITIONAL COMPONENT-SPECIFIC STYLES ===== */
/* Header Components */
.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-color);
}


/* Toolbar Button Variants */
.middle-toolbar-btn,
#double-advert-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: var(--space-xl) 16px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-slow);
}

.middle-toolbar-btn:hover:not(:disabled),
#double-advert-btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

/* Modal overrides */
.modal-content input[type="text"],
.modal-content input[type="url"],
.modal-content input[type="password"],
.modal-content input[type="email"],
.modal-content textarea {
    background: rgba(60, 60, 60, 0.9);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: var(--space-sm);
    border-radius: var(--border-radius-sm);
    width: 100%;
    margin-bottom: var(--space-md);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--space-xxl);
    text-align: center;
    background: rgba(60, 60, 60, 0.3);
    transition: all var(--transition-base);
}

.upload-area.drag-over {
    border-color: var(--accent-color);
    background: rgba(33, 150, 243, 0.1);
}

/* Accent Link Styles */
.accent-links a,
.accent-link {
    color: var(--accent-color) !important;
    text-decoration: none;
}

.accent-links a:hover,
.accent-link:hover {
    color: var(--accent-color) !important;
    text-decoration: underline;
}

.accent-links a:visited,
.accent-link:visited {
    color: var(--accent-color) !important;
}

.accent-links a:active,
.accent-link:active {
    color: var(--accent-color) !important;
}

/* ===== PROFILE COMPONENTS ===== */
.profile-pic-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto var(--space-lg) auto;
    border-radius: var(--border-radius-full);
    overflow: hidden;
    border: 3px solid var(--border-color);
}

#profile-modal-pic {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-pic-edit-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-color);
    padding: var(--space-xs);
    border-radius: var(--border-radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.profile-pic-edit-overlay:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}
