* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
    background: #f8fafc; /* Use solid color to prevent gradient-related CLS */
    min-height: 100vh;
    color: #334155;
    line-height: 1.6;
    /* Prevent font loading layout shifts */
    font-display: swap;
}

/* Professional container styling with layout stability */
.container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    /* Reserve space for content to prevent layout shifts */
    min-height: 100vh;
}

/* Prevent layout shifts from dynamic content */
#app {
    /* Reserve minimum height to prevent CLS */
    min-height: 600px;
}

/* Corporate heading styles */
h1, h2, h3, h4, h5, h6 {
    color: #1e293b;
    font-weight: 700;
    font-family: inherit;
}

/* Professional input styling */
input::placeholder, textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

/* Corporate security badge - ultra compact for mobile */
.security-badge {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0369a1;
    border: 1px solid #7dd3fc;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.12);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0 2px 8px 0;
    display: inline-block;
    white-space: nowrap;
}

/* Character counter styling - prevent layout shifts */
.character-count {
    color: #64748b;
    font-family: inherit;
    /* Reserve space to prevent CLS */
    height: 20px;
    line-height: 20px;
    display: block;
}



/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Header Styles */
.header {
    background: #2563eb;
    border-bottom: none;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
    backdrop-filter: blur(10px);
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    text-decoration: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Simple nav links styling */
.nav-links a:not(.skip-link) {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    font-weight: 500;
}

.nav-links a:not(.skip-link):hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Qapla.pro link styled same as Terms */
.nav-links a[href*="qapla.pro"] {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    background: none;
}

.nav-links a[href*="qapla.pro"]:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.3s ease;
}

.skip-link:focus {
    top: 6px;
    opacity: 1;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Button Styles */
.btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    position: relative;
    overflow: hidden;
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
}

.btn: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;
}

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

.btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

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

.btn:focus,
.btn:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

/* Prevent mobile zoom on input focus */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    font-size: 16px !important;
    transform: translateZ(0);
    -webkit-appearance: none;
    border-radius: 6px;
}

/* Ensure inputs are properly sized on mobile */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"], 
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
        line-height: 1.5;
        padding: 12px;
        width: 100%;
        box-sizing: border-box;
    }
}

/* Improve contrast for better accessibility */
.character-count {
    color: #475569;
    font-weight: 500;
}

/* Performance optimizations */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* Primary submit button enhancement */
.btn[type="submit"], .btn#submitBtn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
    text-transform: none;
    letter-spacing: 0.5px;
    width: 100%;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn[type="submit"]:hover, .btn#submitBtn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

.btn[type="submit"]:disabled, .btn#submitBtn:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    box-shadow: none;
    transform: none;
}

/* Encryption icon - no animation */
.encrypt-icon {
    font-size: 18px;
    display: inline-block;
}

/* Success message fade animation */
@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.message.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

/* Loading Spinner - prevent layout shifts */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    /* Reserve exact space to prevent CLS */
    height: 300px;
    width: 100%;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Feature Grid - prevent layout shifts */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin: 30px 0;
    /* Reserve space to prevent CLS */
    min-height: 200px;
}

/* Prevent layout shifts from dynamic messages */
.form-message {
    /* Reserve consistent height */
    min-height: 50px;
    margin: 15px 0;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.form-message.success-info {
    background: #f0f9ff;
    border-color: #0ea5e9;
    color: #0369a1;
    display: block !important;
    align-items: initial !important;
}

.form-message.error-info {
    background: #fef2f2;
    border-color: #f87171;
    color: #dc2626;
}

/* Prevent layout shifts from quota display */
.quota-display {
    /* Reserve space */
    min-height: 60px;
    width: 100%;
    margin: 20px 0;
}

/* Additional CLS prevention */
img, video {
    /* Prevent image/video loading layout shifts */
    max-width: 100%;
    height: auto;
    display: block;
}

/* Pre-defined sizes for consistent layout */
.message-form textarea {
    /* Fixed height to prevent CLS */
    min-height: 120px;
    resize: vertical;
}

/* Loading skeleton for better UX */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    height: 20px;
    margin: 5px 0;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Ensure consistent button sizes */
.btn {
    /* Fixed height to prevent CLS */
    min-height: 44px;
    box-sizing: border-box;
}

/* Form element stability */
.form-group {
    /* Reserve consistent space */
    margin-bottom: 25px;
    min-height: 60px;
}

/* Input field consistency */
input, textarea, select {
    /* Prevent CLS from focus states */
    border-width: 2px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Security badge container stability */
.security-badge {
    /* Prevent wrapping layout shifts */
    white-space: nowrap;
    flex-shrink: 0;
}

/* Military encryption section stability */
.military-encryption {
    /* Reserve space for grid */
    min-height: 400px;
}

/* Footer stability and contrast */
footer {
    /* Reserve space */
    min-height: 200px;
}

/* Footer styling with proper contrast */
footer {
    background: #f8fafc;
    color: #1f2937; /* Dark gray for better contrast */
}

footer h3 {
    color: #111827 !important; /* Dark text for headings */
}

footer p {
    color: #374151 !important; /* Dark gray for paragraphs */
}

footer a {
    color: #1d4ed8 !important; /* Dark blue for links */
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    color: #1e40af !important; /* Darker blue on hover */
    text-decoration: underline;
}

/* Message Form - prevent layout shifts */
.message-form {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    position: relative;
    /* Reserve consistent height to prevent CLS */
    min-height: 600px;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
}

.form-header {
    text-align: center;
    margin-bottom: 30px;
}

.form-header h2 {
    color: #1e293b;
    margin-bottom: 10px;
}

.form-header p {
    color: #64748b;
}



.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

input, textarea, select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: #1f2937;
    transition: all 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: white;
}

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

.character-count {
    text-align: right;
    font-size: 12px;
    color: #6b7280;
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Message Styles */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    position: relative;
}

.message.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.message.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fca5a5 100%);
    color: #991b1b;
    border: 1px solid #f87171;
}

/* Success/Error Info sections (like security features) */
.success-info, .error-info {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    border-left: 4px solid;
}

.success-info {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-left-color: #10b981;
}

.error-info {
    background: linear-gradient(135deg, #fee2e2 0%, #fca5a5 100%);
    color: #991b1b;
    border-left-color: #ef4444;
}

/* Reply message specific styling */
.reply-message {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    border-left: 4px solid;
}

/* View Page Specific Styles */
.message-container {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    position: relative;
}

.message-content {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #7dd3fc;
    border-radius: 12px;
    padding: 25px;
    margin: 25px 0;
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #1e293b;
    font-family: inherit;
}

.message-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 25px 0;
    font-size: 14px;
    color: #6b7280;
}

.meta-item {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.meta-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

.security-info {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 1px solid #6ee7b7;
    color: #065f46;
    padding: 20px;
    border-radius: 12px;
    margin: 25px 0;
    font-size: 14px;
}

.countdown {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    margin: 20px 0;
}

.reply-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e5e7eb;
}

.reply-form {
    background: #f9fafb;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.deleted-message {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 40px;
}

.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fca5a5 100%);
    color: #991b1b;
    border: 1px solid #f87171;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

/* Feature Cards */
.feature-card {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
}

.feature-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #1e293b;
}

.feature-card p {
    color: #64748b;
    font-size: 14px;
}

/* Landing Page Header */
.header.gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    margin-bottom: 40px;
}

.header.gradient h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Corporate Footer Styling */
footer {
    font-family: inherit;
}

footer a:hover {
    color: #2563eb !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }
    
    .nav {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .header.gradient h1 {
        font-size: 2rem;
    }
    
    /* Footer responsive */
    footer div[style*="display: flex"] {
        flex-direction: column !important;
        text-align: center !important;
        gap: 30px !important;
    }
}