/* ===================================
   Fallback Page - Main Styles
   Inspired by Cloudflare DNS error pages
   =================================== */

/* CSS Variables for easy customization */
:root {
    --primary-color: #0051c3;
    --primary-hover: #003d94;
    --secondary-color: #f0f0f0;
    --secondary-hover: #e0e0e0;
    --text-color: #333333;
    --text-light: #666666;
    --text-lighter: #999999;
    --background: #ffffff;
    --background-alt: #f8f9fa;
    --border-color: #e0e0e0;
    --error-color: #f44336;
    --success-color: #4caf50;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 16px;
    --line-height: 1.6;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #4a9eff;
        --primary-hover: #7bb8ff;
        --secondary-color: #2d2d2d;
        --secondary-hover: #3d3d3d;
        --text-color: #e0e0e0;
        --text-light: #b0b0b0;
        --text-lighter: #808080;
        --background: #1a1a1a;
        --background-alt: #252525;
        --border-color: #404040;
    }
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    color: var(--text-color);
    background: var(--background);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Container */
.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Error Container */
.error-container {
    background: var(--background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.error-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #00d4ff);
}

/* Error Icon */
.error-icon {
    margin-bottom: 20px;
}

.error-icon svg {
    width: 80px;
    height: 80px;
    color: var(--error-color);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Error Code */
.error-code {
    font-size: 6rem;
    font-weight: 700;
    color: var(--error-color);
    line-height: 1;
    margin-bottom: 10px;
    letter-spacing: -2px;
}

/* Error Title */
.error-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 15px;
}

/* Error Message */
.error-message {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 25px;
    line-height: 1.7;
}

/* Error ID Container */
.error-id-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--background-alt);
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.error-id-label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

.error-id {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: var(--text-color);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.copy-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    color: var(--text-light);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-button:hover {
    background: var(--border-color);
    color: var(--text-color);
}

.copy-button svg {
    width: 18px;
    height: 18px;
}

.copy-button.copied {
    color: var(--success-color);
}

/* Action Buttons */
.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-family);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

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

/* ===================================
   Notify Administrator Section
   =================================== */

.notify-section {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.btn-notify {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 12px 28px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-family);
}

.btn-notify:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 81, 195, 0.3);
}

.btn-notify:active {
    transform: translateY(0);
}

.btn-notify svg {
    flex-shrink: 0;
}

/* Notify Status Message */
.notify-status {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    animation: fadeInUp 0.3s ease;
}

.notify-status.success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.notify-status.error {
    background: rgba(244, 67, 54, 0.1);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

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

/* ===================================
   Confirmation Modal
   =================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: 30px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlide 0.3s ease;
    position: relative;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-color);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--background-alt);
    color: var(--text-color);
}

.modal-description {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-body {
    margin-bottom: 24px;
    max-height: 300px;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.modal-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* ===================================
   Data Preview Table
   =================================== */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table tr {
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:last-child {
    border-bottom: none;
}

.data-table td {
    padding: 10px 8px;
    vertical-align: top;
}

.data-label {
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    width: 30%;
    padding-inline-end: 12px;
}

.data-value {
    color: var(--text-light);
    word-break: break-all;
    line-height: 1.5;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

/* ===================================
   RTL Support (Hebrew)
   =================================== */

[dir="rtl"] .error-container::before {
    background: linear-gradient(270deg, var(--primary-color), #00d4ff);
}

[dir="rtl"] .data-label {
    padding-inline-start: 12px;
    padding-inline-end: 0;
}

[dir="rtl"] .modal-close {
    order: -1;
}

[dir="rtl"] .modal-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .data-table {
    text-align: right;
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 640px) {
    .error-container {
        padding: 30px 20px;
    }
    
    .error-code {
        font-size: 4rem;
    }
    
    .error-title {
        font-size: 1.5rem;
    }
    
    .error-message {
        font-size: 1rem;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .actions .btn {
        width: 100%;
    }

    .btn-notify {
        width: 100%;
        justify-content: center;
    }
    
    .modal {
        padding: 24px;
        margin: 10px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }
    
    .data-table td {
        padding: 8px 6px;
    }

    .data-label {
        width: 35%;
    }
}

/* ===================================
   Accessibility
   =================================== */

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

/* Focus styles for keyboard navigation */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .error-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .btn,
    .btn-notify,
    .copy-button,
    .modal-overlay {
        display: none;
    }
}