/**
 * File: assets/css/frontend-styles.css
 * General frontend styling and utilities
 * Updated for Orange (#f38221) & Purple (#181743) Theme
 */

/* Base Styles */
.as-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.as-section {
    margin: 40px 0;
}

.as-section-title {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    color: #1d2327;
    line-height: 1.2;
}

.as-section-subtitle {
    font-size: 18px;
    text-align: center;
    color: #646970;
    margin-bottom: 40px;
    line-height: 1.5;
}

/* Button Styles */
.as-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
    box-sizing: border-box;
}

.as-btn-primary {
    background: linear-gradient(135deg, #181743 0%, #2d1b69 100%);
    color: white;
    border: 2px solid transparent;
}

.as-btn-primary:hover {
    background: linear-gradient(135deg, #2d1b69 0%, #181743 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(24, 23, 67, 0.3);
    text-decoration: none;
}

.as-btn-secondary {
    background: white;
    color: #181743;
    border: 2px solid #181743;
}

.as-btn-secondary:hover {
    background: #181743;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(24, 23, 67, 0.2);
    text-decoration: none;
}

.as-btn-accent {
    background: linear-gradient(135deg, #f38221 0%, #ff9642 100%);
    color: white;
    border: 2px solid transparent;
}

.as-btn-accent:hover {
    background: linear-gradient(135deg, #ff9642 0%, #f38221 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(243, 130, 33, 0.3);
    text-decoration: none;
}

.as-btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.as-btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

.as-btn:disabled,
.as-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Loading States */
.as-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.as-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #f38221;
    border-radius: 50%;
    animation: as-spin 1s linear infinite;
}

@keyframes as-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Voting System */
.as-vote-btn i {
    font-size: 16px;
}

.as-vote-count {
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.as-vote-btn.voting {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.as-vote-success {
    animation: as-vote-pulse 0.6s ease;
}

@keyframes as-vote-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Submission Cards */
.as-submission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.as-submission-content {
    padding: 20px;
}

.as-submission-title {
    font-size: 20px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.as-submission-description {
    color: #646970;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

.as-submission-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 16px 0;
    padding-top: 16px;
    border-top: 1px solid #f0f0f1;
}

.as-submission-size {
    font-size: 14px;
    color: #181743;
    font-weight: 600;
}

.as-submission-votes {
    display: flex;
    align-items: center;
    gap: 12px;
}

.as-vote-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #646970;
}

.as-vote-display i {
    color: #f38221;
    font-size: 16px;
}

.as-vote-total {
    font-weight: 600;
    color: #1d2327;
    font-size: 14px;
}

/* Submission Actions */
.as-submission-actions {
    padding: 16px 20px;
    background: #f8f9fa;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
}

.as-action-group {
    display: flex;
    gap: 8px;
}

/* Empty States */
.as-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #646970;
}

.as-empty-state i {
    font-size: 64px;
    color: #f38221;
    margin-bottom: 20px;
    display: block;
}

.as-empty-state h3 {
    font-size: 24px;
    color: #181743;
    margin: 0 0 12px 0;
}

.as-empty-state p {
    font-size: 16px;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

/* Success Messages */
.as-success-message {
    background: linear-gradient(135deg, #f38221 0%, #ff9642 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(243, 130, 33, 0.3);
}

.as-success-message i {
    margin-right: 12px;
    font-size: 20px;
}

.as-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.as-close-btn:hover {
    opacity: 1;
}

/* Error Messages */
.as-error-message {
    background: linear-gradient(135deg, #d63638 0%, #b32d2e 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(214, 54, 56, 0.3);
}

.as-error-message i {
    margin-right: 12px;
    font-size: 20px;
}

/* Info Messages */
.as-info-message {
    background: linear-gradient(135deg, #181743 0%, #2d1b69 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(24, 23, 67, 0.3);
}

.as-info-message i {
    margin-right: 12px;
    font-size: 20px;
}

/* Tooltips */
.as-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.as-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #181743;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 1;
    visibility: visible;
}

.as-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #181743;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

/* Badges */
.as-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.as-badge-new {
    background: linear-gradient(135deg, #f38221 0%, #ff9642 100%);
    color: white;
}

.as-badge-popular {
    background: linear-gradient(135deg, #f38221 0%, #ff9642 100%);
    color: white;
}

.as-badge-featured {
    background: linear-gradient(135deg, #181743 0%, #2d1b69 100%);
    color: white;
}

.as-badge-pending {
    background: linear-gradient(135deg, #181743 0%, #2d1b69 100%);
    color: white;
}

/* Progress Indicators */
.as-progress {
    width: 100%;
    height: 8px;
    background: #f0f0f1;
    border-radius: 4px;
    overflow: hidden;
}

.as-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #181743 0%, #f38221 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Utility Classes */
.as-text-center { text-align: center; }
.as-text-left { text-align: left; }
.as-text-right { text-align: right; }

.as-hidden { display: none !important; }
.as-visible { display: block !important; }

.as-fade-in {
    animation: as-fadeIn 0.5s ease-in;
}

.as-slide-up {
    animation: as-slideUp 0.5s ease-out;
}

@keyframes as-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes as-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Spacing Utilities */
.as-mb-0 { margin-bottom: 0 !important; }
.as-mb-1 { margin-bottom: 8px !important; }
.as-mb-2 { margin-bottom: 16px !important; }
.as-mb-3 { margin-bottom: 24px !important; }
.as-mb-4 { margin-bottom: 32px !important; }
.as-mb-5 { margin-bottom: 40px !important; }

.as-mt-0 { margin-top: 0 !important; }
.as-mt-1 { margin-top: 8px !important; }
.as-mt-2 { margin-top: 16px !important; }
.as-mt-3 { margin-top: 24px !important; }
.as-mt-4 { margin-top: 32px !important; }
.as-mt-5 { margin-top: 40px !important; }

.as-p-0 { padding: 0 !important; }
.as-p-1 { padding: 8px !important; }
.as-p-2 { padding: 16px !important; }
.as-p-3 { padding: 24px !important; }
.as-p-4 { padding: 32px !important; }
.as-p-5 { padding: 40px !important; }

/* Responsive Utilities */
@media (max-width: 1024px) {
    .as-container {
        padding: 0 16px;
    }
    
    .as-submission-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .as-section-title {
        font-size: 28px;
    }
    
    .as-section-subtitle {
        font-size: 16px;
    }
    
    .as-submission-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .as-vote-section {
        gap: 12px;
    }
    
    .as-submission-actions {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .as-action-group {
        justify-content: center;
    }
    
    .as-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .as-btn-small {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .as-btn-large {
        padding: 14px 28px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .as-container {
        padding: 0 12px;
    }
    
    .as-section {
        margin: 24px 0;
    }
    
    .as-section-title {
        font-size: 24px;
    }
    
    .as-submission-content {
        padding: 16px;
    }
    
    .as-submission-actions {
        padding: 12px 16px;
    }
    
    .as-vote-section {
        flex-direction: column;
        gap: 8px;
    }
    
    .as-vote-btn {
        width: 100%;
        justify-content: center;
    }
    
    .as-success-message,
    .as-error-message,
    .as-info-message {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .as-empty-state {
        padding: 40px 16px;
    }
    
    .as-empty-state i {
        font-size: 48px;
    }
    
    .as-empty-state h3 {
        font-size: 20px;
    }
    
    .as-empty-state p {
        font-size: 14px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .as-btn-primary,
    .as-btn-accent {
        border: 2px solid currentColor;
    }
    
    .as-vote-btn {
        border-width: 2px;
    }
    
    .as-submission-card {
        border: 1px solid #646970;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .as-submission-card:hover {
        transform: none;
    }
    
    .as-btn:hover {
        transform: none;
    }
    
    .as-vote-btn:hover {
        transform: none;
    }
}

/* Print Styles */
@media print {
    .as-vote-section,
    .as-submission-actions,
    .as-btn {
        display: none;
    }
    
    .as-submission-card {
        box-shadow: none;
        border: 1px solid #000;
        break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .as-submission-image {
        height: auto;
        max-height: 200px;
    }
    
    .as-success-message,
    .as-error-message,
    .as-info-message {
        background: none;
        color: #000;
        border: 1px solid #000;
    }
}

/* Hide scrollbars but keep scroll functionality */
.as-hide-scrollbar {
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
    scrollbar-width: none;     /* Firefox */
}

.as-hide-scrollbar::-webkit-scrollbar {
    display: none;             /* Safari and Chrome */
}

/* Modal Styles */
.as-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.as-modal.active {
    opacity: 1;
    visibility: visible;
}

.as-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.as-modal-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.as-modal.active .as-modal-container {
    transform: translate(-50%, -50%) scale(1);
}

.as-modal-header {
    padding: 20px 20px 0;
    display: flex;
    justify-content: flex-end;
}

.as-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #646970;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 1000;
    position: relative;
}

.as-modal-close:hover {
    background: #f0f0f1;
    color: #181743;
}

.as-modal-content {
    padding: 0 20px 20px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* Apply hidden scrollbar to modal content */
.as-modal-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.as-modal-content::-webkit-scrollbar {
    display: none;
}

.as-modal-loading {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
}

.as-modal-loading i {
    font-size: 32px;
    margin-bottom: 16px;
    display: block;
}

/* Modal improvements for styled forms */
.as-modal-container.as-styled-form-modal {
    background: transparent;
    box-shadow: none;
    max-width: 560px;
    overflow: visible;
}

.as-modal-container.as-styled-form-modal .as-modal-header {
    padding: 0;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1001;
}

.as-modal-container.as-styled-form-modal .as-modal-content {
    padding: 0;
    overflow: visible;
}

.as-modal-container.as-styled-form-modal .as-modal-close {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.as-modal-container.as-styled-form-modal .as-modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

/* Ensure the styled form container takes full space in modal */
.as-modal-container.as-styled-form-modal .as-styled-form-container {
    margin: 0;
    max-width: none;
    width: 100%;
    box-shadow: 0 20px 60px rgba(24, 23, 67, 0.4);
    overflow-y: auto;
    max-height: 90vh;
}

/* Apply hidden scrollbar to styled form container in modal */
.as-modal-container.as-styled-form-modal .as-styled-form-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.as-modal-container.as-styled-form-modal .as-styled-form-container::-webkit-scrollbar {
    display: none;
}

/* Prevent body scroll when modal is open */
body.as-modal-open {
    overflow: hidden;
}

/* Mobile styles */
@media (max-width: 768px) {
    .as-modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .as-modal-content {
        max-height: calc(95vh - 80px);
    }
    
    .as-modal-container.as-styled-form-modal {
        max-width: 95%;
    }
    
    .as-modal-container.as-styled-form-modal .as-modal-close {
        width: 36px;
        height: 36px;
        font-size: 18px;
        top: 10px;
        right: 10px;
    }
    
    .as-modal-container.as-styled-form-modal .as-styled-form-container {
        max-height: 95vh;
    }
}

/* Specificity fix for My Account page grid layout */
.as-account-section .as-submission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}


.as-submission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.as-submission-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.as-submission-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.as-submission-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    position: relative;
}

.as-submission-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.as-submission-content {
    padding: 1.5rem;
}

.as-submission-actions {
    padding: 0 1.5rem 1.5rem;
    border-top: 1px solid #e5e5e5;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Ensure not full width */
.as-user-submissions {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}


.as-submission-card.editing {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 10;
    position: relative;
}

.as-inline-edit-container {
    padding: 2rem;
    background: #f8f9fa;
}

.as-inline-edit-header h3 {
    margin: 0 0 1rem 0;
    color: #333;
}

.as-inline-edit-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.as-inline-edit-actions .as-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.as-btn-danger {
    background: #d63638;
    color: white;
    border: 1px solid #d63638;
}

.as-btn-danger:hover {
    background: #b32629;
}

.word-limit-warning .as-word-counter {
    color: #dba617;
}

.word-limit-reached .as-word-counter {
    color: #d63638;
}

.file-selected {
    background: #00ba37 !important;
    color: white !important;
}

/* Fix for My Aquarium page grid layout - ensure cards are not full width */
.as-user-submissions .as-submission-grid,
.as-account-section .as-submission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.as-user-submissions .as-submission-card,
.as-account-section .as-submission-card {
    max-width: none; /* Remove any max-width constraints */
    width: 100%;     /* Use full grid cell width */
}

/* Ensure the container itself isn't constrained */
.as-user-submissions {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.as-current-image-display {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.as-current-image-display img {
    max-width: 300px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.as-photo-note {
    margin: 1rem 0 0 0;
    font-size: 14px;
    color: #6c757d;
    font-style: italic;
}

.as-form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.as-form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.as-form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.as-form-group input,
.as-form-group textarea {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.as-form-group input:focus,
.as-form-group textarea:focus {
    outline: none;
    border-color: #f38221;
    box-shadow: 0 0 0 3px rgba(243, 130, 33, 0.1);
}

@media (max-width: 768px) {
    .as-form-row {
        flex-direction: column;
    }
}