/* Base CSS - Shared styles to eliminate duplication across the application */

/* ===== UNIVERSAL RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* ===== BUTTON STYLES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    white-space: nowrap;
}

.btn:focus {
    outline: 3px solid var(--primary-orange, #ff6b35);
    outline-offset: 2px;
}

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

.btn-primary {
    background: var(--gradient-orange, linear-gradient(135deg, #ff6b35, #ff8f65));
    color: var(--white, #ffffff);
    border-color: transparent;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-black, #1a1a1a);
    color: var(--white, #ffffff);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-black, #1a1a1a);
    border-color: var(--border-color, #e5e7eb);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--light-grey, #f3f4f6);
    border-color: var(--primary-orange, #ff6b35);
    color: var(--primary-orange, #ff6b35);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-orange, #ff6b35);
    border: 2px solid var(--primary-orange, #ff6b35);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-orange, #ff6b35);
    color: var(--white, #ffffff);
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc2626;
    color: var(--white, #ffffff);
    border-color: #dc2626;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    transform: translateY(-2px);
}

/* Loading state for buttons */
.btn.loading {
    color: transparent;
    pointer-events: none;
    position: relative;
}

.btn.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark, #111827);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--white, #ffffff);
    color: var(--text-dark, #111827);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: 3px solid var(--primary-orange, #ff6b35);
    outline-offset: 2px;
    border-color: var(--primary-orange, #ff6b35);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

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

/* Form validation states */
.form-group.valid input,
.form-group.valid textarea,
.form-group.valid select {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.form-group.invalid input,
.form-group.invalid textarea,
.form-group.invalid select {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.form-group.warning input,
.form-group.warning textarea,
.form-group.warning select {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

/* ===== MODAL STYLES ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white, #ffffff);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-dark, #111827);
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light, #6b7280);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--light-grey, #f3f4f6);
    color: var(--text-dark, #111827);
}

.modal-body {
    padding: 1.5rem;
}

.modal-actions {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* ===== LOADING STATES ===== */
.loading {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light, #6b7280);
    font-size: 1.1rem;
}

.loading::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color, #e5e7eb);
    border-top: 4px solid var(--primary-orange, #ff6b35);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

/* ===== ERROR POPUP ===== */
.form-error-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.form-error-popup.active {
    opacity: 1;
    visibility: visible;
}

.error-content {
    background: var(--white, #ffffff);
    padding: 2rem;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.form-error-popup.active .error-content {
    transform: translateY(0);
}

.error-content h3 {
    color: #dc2626;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.error-content p {
    color: var(--text-light, #6b7280);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ===== GRID LAYOUTS ===== */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.grid-container {
    display: grid;
    gap: 2rem;
}

/* ===== UTILITY ANIMATIONS ===== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

.bounce-in {
    animation: bounceIn 0.4s ease;
}

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

/* ===== RESPONSIVE BREAKPOINTS ===== */
/* Standard mobile breakpoint */
@media (max-width: 768px) {
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-actions {
        padding: 1rem;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .loading {
        padding: 2rem 1rem;
    }
}

/* Small mobile breakpoint */
@media (max-width: 480px) {
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.875rem;
    }
    
    .modal-content {
        max-height: 95vh;
    }
}

/* Large screen optimizations */
@media (min-width: 1200px) {
    .categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 2.5rem;
    }
}