/* =====================================================
   CHARACTER FORGE STYLES
   Styles for the 4-view character sheet generation panel
   ===================================================== */

/* Character Sheet Panel */
.character-sheet-panel {
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-radius: 16px;
    padding: 24px;
    margin-top: 20px;
    border: 1px solid var(--border-color);
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.character-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.character-sheet-header h3 {
    margin: 0;
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.character-sheet-header .back-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.character-sheet-header .back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Character Name Display */
.character-name-display {
    text-align: center;
    margin-bottom: 20px;
}

.character-name-display h4 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.character-name-display p {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* 4-View Grid Layout */
.character-views-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 900px) {
    .character-views-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Individual Character View */
.character-view {
    position: relative;
    background: var(--bg-primary);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
}

.character-view:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.2);
}

.character-view.front-view {
    border-color: var(--accent-primary);
}

.character-view.has-image {
    border-color: var(--success-color, #4CAF50);
}

/* View Label */
.view-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    z-index: 10;
    text-transform: uppercase;
}

/* View Placeholder */
.view-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 9 / 16;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-placeholder:hover {
    background: var(--bg-hover);
}

.view-placeholder[data-locked="true"] {
    cursor: not-allowed;
    opacity: 0.5;
}

.view-placeholder[data-locked="true"]:hover {
    background: transparent;
}

.placeholder-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.7;
}

.view-placeholder span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Loading Spinner for Views */
.view-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 9 / 16;
    background: var(--bg-primary);
}

.view-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.view-loading span {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Generated Image */
.view-image-container {
    position: relative;
    aspect-ratio: 9 / 16;
    background: var(--bg-primary);
}

.view-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bg-primary);
}

/* Item mode - 1:1 aspect ratio */
.character-sheet-panel.item-mode .view-placeholder,
.character-sheet-panel.item-mode .view-loading,
.character-sheet-panel.item-mode .view-image-container {
    aspect-ratio: 1 / 1;
}

/* Save Button Overlay */
.save-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 20px 12px 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    justify-content: flex-end;
}

.character-view:hover .save-overlay {
    opacity: 1;
}

.save-view-btn {
    background: var(--accent-primary);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.save-view-btn:hover {
    transform: scale(1.1);
    background: var(--accent-secondary);
}

.save-view-btn.saved {
    background: var(--success-color, #4CAF50);
}

/* Edit Section */
.edit-section {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 16px;
}

.edit-section input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.edit-section input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.edit-section input::placeholder {
    color: var(--text-muted);
}

#btn-apply-edit {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#btn-apply-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

#btn-apply-edit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Character Actions */
.character-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Generate 360 Button */
.btn-360 {
    width: 100%;
    background: linear-gradient(135deg, #00d9ff, #6c5ce7);
    border: none;
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-360::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-360:hover::before {
    left: 100%;
}

.btn-360:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 217, 255, 0.4);
}

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

.btn-360:disabled::before {
    display: none;
}

/* Save Actions */
.save-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.save-all-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: none;
    color: white;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.save-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.save-all-btn .material-icons {
    font-size: 1.2rem;
}

/* Generation Form in Character Panel */
.forge-generation-form {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.forge-generation-form .form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.forge-generation-form .form-group {
    flex: 1;
}

.forge-generation-form label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.forge-generation-form input,
.forge-generation-form textarea,
.forge-generation-form select {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.forge-generation-form input:focus,
.forge-generation-form textarea:focus,
.forge-generation-form select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.forge-generation-form textarea {
    resize: vertical;
    min-height: 80px;
}

/* Status Messages */
.forge-status {
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.forge-status.info {
    background: rgba(0, 217, 255, 0.1);
    color: #00d9ff;
    border: 1px solid rgba(0, 217, 255, 0.3);
}

.forge-status.success {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.forge-status.error {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .character-views-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .character-sheet-panel {
        padding: 16px;
    }

    .edit-section {
        flex-direction: column;
    }

    .btn-360 {
        font-size: 1rem;
        padding: 14px 20px;
    }
}

/* =====================================================
   FULLSCREEN IMAGE MODAL
   ===================================================== */

.forge-fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.forge-fullscreen-modal.active {
    opacity: 1;
    visibility: visible;
}

.fullscreen-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fullscreen-modal-image {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.fullscreen-modal-label {
    margin-top: 16px;
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 20px;
    font-weight: 600;
    font-size: 1rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.fullscreen-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.fullscreen-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
    transform: scale(1.1);
}

/* Navigation arrows for fullscreen modal */
.fullscreen-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.fullscreen-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.fullscreen-nav-btn.prev {
    left: 20px;
}

.fullscreen-nav-btn.next {
    right: 20px;
}

/* View image clickable cursor */
.view-image-container {
    cursor: pointer;
}

.view-image-container:hover .view-image {
    filter: brightness(1.05);
}