/**
 * Presale Code Manager - Stylesheet
 * Modern, responsive styling with animations
 */

:root {
    --pcm-primary: #0664fd;
    --pcm-primary-hover: #0553d6;
    --pcm-add-btn: #0664fd;
    --pcm-add-btn-hover: #0553d6;
    --pcm-update-btn: #22c55e;
    --pcm-update-btn-hover: #16a34a;
    --pcm-report-btn: #ef4444;
    --pcm-report-btn-hover: #dc2626;
    --pcm-success: #10b981;
    --pcm-warning: #f59e0b;
    --pcm-border: #e5e7eb;
    --pcm-text: #1f2937;
    --pcm-text-light: #6b7280;
    --pcm-bg-light: #eaf2ff;
    --pcm-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --pcm-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --pcm-transition: all 0.3s ease;
}

/* Google Fonts */
.pcm-button-container,
.pcm-modal,
.pcm-success-message {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Button Container */
.pcm-button-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.pcm-button-left {
    display: flex;
    gap: 0.75rem;
}

.pcm-button-right {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.pcm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: var(--pcm-transition);
    box-shadow: var(pcm-shadow);
    white-space: nowrap;
    text-align: center;
    position: relative;
    background-clip: padding-box;
}

.pcm-btn *,
.pcm-btn *::before,
.pcm-btn *::after {
    pointer-events: none !important;
}

.pcm-btn-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.pcm-btn:focus {
    outline: 2px solid var(--pcm-primary);
    outline-offset: 2px;
}

.pcm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Add Presale Button - Brand Blue */
.pcm-btn-add {
    background-color: var(--pcm-add-btn);
    color: white;
}

.pcm-btn-add:hover:not(:disabled) {
    background-color: var(--pcm-add-btn-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 100, 253, 0.4);
}

/* Update Button - Green Gradient */
.pcm-btn-update {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.pcm-btn-update:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

/* Report Code Button - Red */
.pcm-btn-report {
    background-color: var(--pcm-report-btn);
    color: white;
}

.pcm-btn-report:hover:not(:disabled) {
    background-color: var(--pcm-report-btn-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Primary Button (for submit buttons in modals) */
.pcm-btn-primary {
    background-color: var(--pcm-primary);
    color: white;
}

.pcm-btn-primary:hover:not(:disabled) {
    background-color: var(--pcm-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 100, 253, 0.3);
}

/* Outline Button */
.pcm-btn-outline {
    background-color: white;
    color: var(--pcm-primary);
    border: 2px solid var(--pcm-primary);
}

.pcm-btn-outline:hover:not(:disabled) {
    background-color: var(--pcm-primary);
    color: white;
    transform: translateY(-1px);
}

/* Full Width Button */
.pcm-btn-full {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    margin-top: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 300px;
}

/* Modal Overlay */
.pcm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: -1;
    overflow-y: auto;
    padding: 1rem;
    animation: pcm-fadeIn 0.3s ease;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.pcm-modal-active {
    display: flex;
    z-index: 9999;
    pointer-events: auto;
}

/* Modal Content */
.pcm-modal-content {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    position: relative;
    box-shadow: var(--pcm-shadow-lg);
    animation: pcm-modalSlideIn 0.3s ease;
}

/* Modal Close Button */
.pcm-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f3f4f6;
    border: none;
    font-size: 1.5rem;
    color: var(--pcm-text);
    cursor: pointer;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    z-index: 10;
}

.pcm-modal-close svg {
    width: 1.75rem;
    height: 1.75rem;
    stroke-width: 3;
    transition: transform 0.3s ease;
}

.pcm-modal-close:hover svg {
    transform: rotate(90deg);
}

/* Modal Title */
.pcm-modal-title {
    color: var(--pcm-primary);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
    padding-right: 2rem;
}

/* Notice Banners */
.pcm-notice {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    animation: pcm-slideDown 0.3s ease;
}

.pcm-notice-warning {
    background-color: var(--pcm-warning);
    color: white;
}

.pcm-notice-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.pcm-notice-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Form Groups */
.pcm-form-group {
    margin-bottom: 1.5rem;
}

.pcm-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--pcm-text);
    font-weight: 500;
    font-size: 0.95rem;
}

/* Input Table */
.pcm-table-wrapper {
    margin-bottom: 0;
    overflow-x: auto;
}

.pcm-input-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: white;
    border: 2px solid var(--pcm-primary);
    border-radius: 12px;
    overflow: hidden;
}

.pcm-input-table thead {
    background-color: var(--pcm-primary);
}

.pcm-input-table th {
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    color: white;
    font-size: 1rem;
    border-bottom: none;
}

.pcm-input-table th:first-child {
    border-top-left-radius: 10px;
}

.pcm-input-table th:last-child {
    border-top-right-radius: 10px;
}

/* Prevent header color change on hover - Force brand blue */
.pcm-input-table thead:hover,
.pcm-input-table thead:hover th,
.pcm-input-table th:hover {
    background-color: var(--pcm-primary) !important;
    background: var(--pcm-primary) !important;
}

.pcm-input-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #d1e5ff;
    background-color: var(--pcm-bg-light);
}

.pcm-input-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 10px;
}

.pcm-input-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 10px;
}

.pcm-input-table tbody tr:last-child td {
    border-bottom: none;
}

/* Ensure no hover effects on table rows */
.pcm-input-table tbody tr:hover {
    background-color: transparent;
}

.pcm-input-table tbody tr:hover td {
    background-color: var(--pcm-bg-light);
}

/* Input Fields */
.pcm-input,
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    color: var(--pcm-text);
    background-color: #fafafa;
    border: 2px solid #83b2ff;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--pcm-transition);
}

/* Additional details specific styling */
#pcm-additional-details,
#pcm-update-text,
#pcm-issue-text {
    font-size: 16px;
    border-radius: 10px;
}

.pcm-input::placeholder,
textarea::placeholder {
    font-size: 0.85rem;
    color: #9ca3af;
}

.pcm-input:focus,
textarea:focus {
    outline: none;
    border-color: var(--pcm-primary);
    box-shadow: 0 0 0 4px rgba(6, 100, 253, 0.1);
    background-color: white;
}

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

/* Success Message */
.pcm-success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background-color: white;
    padding: 2rem 2.5rem;
    border-radius: 1rem;
    box-shadow: var(--pcm-shadow-lg);
    z-index: -1;
    opacity: 0;
    transition: var(--pcm-transition);
    border: 3px solid var(--pcm-success);
    pointer-events: none;
}

.pcm-success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.pcm-success-active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    z-index: 10000;
}

.pcm-success-icon {
    width: 4rem;
    height: 4rem;
    flex-shrink: 0;
    animation: pcm-checkmarkPop 0.5s ease;
}

.pcm-success-text {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--pcm-text);
    text-align: center;
}

@keyframes pcm-checkmarkPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Animations */
@keyframes pcm-fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pcm-modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes pcm-slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .pcm-button-container {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: nowrap;
    }
    
    .pcm-button-left {
        flex: 1;
    }
    
    .pcm-button-left .pcm-btn {
        width: 100%;
        justify-content: center;
    }
    
    .pcm-button-right {
        display: flex;
        gap: 0.5rem;
        flex-shrink: 0;
    }
    
    /* Show icons on mobile for Update and Report */
    .pcm-btn-update .pcm-btn-icon,
    .pcm-btn-report .pcm-btn-icon {
        display: block;
    }
    
    /* Hide button text on mobile for Update and Report, show icons only */
    .pcm-btn-update .pcm-btn-text,
    .pcm-btn-report .pcm-btn-text {
        display: none;
    }
    
    .pcm-btn-update,
    .pcm-btn-report {
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .pcm-modal-content {
        padding: 1.5rem;
        margin: 0;
        max-height: calc(100vh - 4rem);
        overflow-y: auto;
    }
    
    .pcm-modal-title {
        font-size: 1.5rem;
    }
    
    .pcm-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .pcm-input-table {
        min-width: 100%;
    }
    
    .pcm-input-table th,
    .pcm-input-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .pcm-success-message {
        max-width: calc(100% - 2rem);
        padding: 1.5rem 2rem;
    }
    
    .pcm-success-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .pcm-modal-content {
        padding: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    .pcm-btn {
        font-size: 0.875rem;
        padding: 8px 16px;
    }
    
    .pcm-btn-update,
    .pcm-btn-report {
        width: 40px;
        height: 40px;
    }
    
    .pcm-modal-title {
        font-size: 1.25rem;
    }
    
    .pcm-input-table th,
    .pcm-input-table td {
        padding: 0.625rem 0.375rem;
        font-size: 0.85rem;
    }
    
    .pcm-success-message {
        padding: 1.25rem 1.5rem;
    }
    
    .pcm-success-icon {
        width: 3rem;
        height: 3rem;
    }
}

/* Print Styles */
@media print {
    .pcm-button-container,
    .pcm-modal,
    .pcm-success-message {
        display: none !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .pcm-btn-outline {
        border-width: 3px;
    }
    
    .pcm-input:focus,
    textarea:focus {
        outline: 3px solid var(--pcm-primary);
    }
}
