/**
 * Mail Guard - Stylesheet
 * Mobile-First Responsive Design
 * Koyu tema, kırmızı tonları
 * Özgün tasarım - klişelerden kaçın
 */

:root {
    /* Kırmızı tonları - Özgün renk paleti */
    --color-primary: #dc2626;
    --color-primary-dark: #991b1b;
    --color-primary-light: #ef4444;
    --color-accent: #f87171;
    --color-accent-light: #fca5a5;

    /* Koyu tema */
    --color-bg-primary: #0a0a0a;
    --color-bg-secondary: #1a1a1a;
    --color-bg-tertiary: #2a2a2a;
    --color-bg-card: #1f1f1f;

    /* Metin renkleri */
    --color-text-primary: #f5f5f5;
    --color-text-secondary: #a3a3a3;
    --color-text-muted: #737373;

    /* Border ve ayırıcılar */
    --color-border: #3a3a3a;
    --color-border-light: #4a4a4a;

    /* Durum renkleri */
    --color-success: #22c55e;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;

    /* Spacing - Mobile-first */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Typography - Fluid typography için base değerler */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);

    /* Touch targets - Minimum 44x44px */
    --touch-target-min: 44px;
}

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

html {
    /* Smooth scrolling */
    scroll-behavior: smooth;
    /* Font rendering optimization */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Text rendering optimization */
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    min-height: 100vh;
    /* Prevent horizontal scroll */
    overflow-x: hidden;
    /* Touch optimization */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Container - Mobile-first */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

/* Header - Mobile-first */
.header {
    padding: var(--spacing-lg) 0;
    margin-bottom: var(--spacing-lg);
    position: relative;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
}

.header__content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.header__title {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--color-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(220, 38, 38, 0.3);
    line-height: 1.2;
}

.header__subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin: 0;
    font-weight: 400;
}

.header__stats {
    display: flex;
    gap: var(--spacing-md);
    width: 100%;
    justify-content: flex-start;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stat-value {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.stat-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: var(--spacing-xs);
}

/* Alert */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    border-left: 4px solid;
    word-wrap: break-word;
}

.alert--error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--color-error);
    color: var(--color-error);
}

.alert--success {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--color-success);
    color: var(--color-success);
}

/* Mail List - Mobile-first Grid */
.mail-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
}

/* Mail Card - Modern Design */
.mail-card {
    background: linear-gradient(135deg, 
        rgba(31, 31, 31, 0.95) 0%, 
        rgba(26, 26, 26, 0.98) 50%,
        rgba(31, 31, 31, 0.95) 100%);
    border: 1px solid rgba(58, 58, 58, 0.6);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    /* Touch optimization */
    -webkit-tap-highlight-color: transparent;
    /* Modern glass effect */
    background-color: rgba(31, 31, 31, 0.7);
}

/* Gradient border effect */
.mail-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(
        180deg, 
        var(--color-primary) 0%,
        var(--color-primary-light) 50%,
        var(--color-primary) 100%
    );
    opacity: 0;
    transition: opacity 0.4s ease, width 0.4s ease;
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}

/* Shine effect on hover */
.mail-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(220, 38, 38, 0.1) 50%,
        transparent 70%
    );
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
    pointer-events: none;
}

/* Hover only on devices that support it */
@media (hover: hover) and (pointer: fine) {
    .mail-card:hover {
        border-color: rgba(220, 38, 38, 0.5);
        transform: translateY(-6px) scale(1.01);
        box-shadow: 
            0 20px 40px rgba(220, 38, 38, 0.2),
            0 10px 20px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
        background: linear-gradient(135deg, 
            rgba(42, 42, 42, 0.95) 0%, 
            rgba(31, 31, 31, 0.98) 50%,
            rgba(42, 42, 42, 0.95) 100%);
    }

    .mail-card:hover::before {
        opacity: 1;
        width: 4px;
    }

    .mail-card:hover::after {
        opacity: 1;
        top: -100%;
        left: -100%;
    }
}

/* Touch devices - active state */
.mail-card:active {
    transform: scale(0.97);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mail-card__header {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    width: 100%;
    position: relative;
    z-index: 1;
}

.mail-card__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm);
}

.mail-card__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--font-size-sm);
    line-height: 1.4;
    /* Touch-friendly minimum size */
    min-height: 32px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mail-card__badge::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 ease;
}

.mail-card__badge:hover::before {
    left: 100%;
}

.mail-card__badge--code {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: white;
    font-size: var(--font-size-xl);
    font-weight: 800;
    letter-spacing: 3px;
    padding: var(--spacing-md) var(--spacing-lg);
    min-height: 48px;
    box-shadow: 
        0 4px 12px rgba(220, 38, 38, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mail-card__badge--code:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 16px rgba(220, 38, 38, 0.5),
        0 3px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.mail-card__badge--account {
    background: linear-gradient(135deg, #3a9aed 0%, #5ab0f5 100%);
    color: white;
    font-size: var(--font-size-sm);
    box-shadow: 
        0 2px 8px rgba(58, 154, 237, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mail-card__badge--account:hover {
    transform: translateY(-1px);
    box-shadow: 
        0 4px 12px rgba(58, 154, 237, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.mail-card__badge--country {
    background: linear-gradient(135deg, var(--color-success) 0%, #4ade80 100%);
    color: white;
    font-size: var(--font-size-sm);
    box-shadow: 
        0 2px 8px rgba(34, 197, 94, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mail-card__badge--country:hover {
    transform: translateY(-1px);
    box-shadow: 
        0 4px 12px rgba(34, 197, 94, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.mail-card__date {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-xs);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: rgba(58, 58, 58, 0.4);
    border-radius: var(--radius-md);
    border: 1px solid rgba(58, 58, 58, 0.6);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-weight: 500;
}

.mail-card__date:hover {
    background: rgba(58, 58, 58, 0.6);
    border-color: rgba(220, 38, 38, 0.3);
    color: var(--color-text-primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--color-text-muted);
}

.empty-state p {
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-sm);
}

.empty-state p:last-child {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: 0;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.mail-card {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stagger animation for multiple cards */
.mail-list .mail-card:nth-child(1) { animation-delay: 0.05s; }
.mail-list .mail-card:nth-child(2) { animation-delay: 0.1s; }
.mail-list .mail-card:nth-child(3) { animation-delay: 0.15s; }
.mail-list .mail-card:nth-child(4) { animation-delay: 0.2s; }
.mail-list .mail-card:nth-child(5) { animation-delay: 0.25s; }
.mail-list .mail-card:nth-child(n+6) { animation-delay: 0.3s; }

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-primary-dark);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* ============================================
   RESPONSIVE BREAKPOINTS - Mobile-First
   ============================================ */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .container {
        padding: var(--spacing-lg);
    }

    .header {
        padding: var(--spacing-xl) 0;
        margin-bottom: var(--spacing-xl);
    }

    .header__title {
        font-size: var(--font-size-3xl);
        letter-spacing: 3px;
    }

    .header__subtitle {
        font-size: var(--font-size-base);
    }

    .header__stats {
        justify-content: flex-end;
    }

    .stat-item {
        align-items: flex-end;
    }

    .mail-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: var(--spacing-lg);
    }

    .mail-card {
        padding: var(--spacing-lg);
    }

    .mail-card__header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: var(--spacing-md);
    }

    .mail-card__badges {
        flex: 1;
    }

    .mail-card__date {
        margin-top: 0;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .container {
        padding: var(--spacing-xl);
    }

    .header {
        padding: var(--spacing-2xl) 0;
        margin-bottom: var(--spacing-2xl);
    }

    .header__content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .header__stats {
        width: auto;
        justify-content: flex-end;
    }

    .mail-list {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: var(--spacing-xl);
    }

    .mail-card {
        padding: var(--spacing-xl);
    }

    .mail-card__badge--code {
        font-size: 1.5em;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .mail-list {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .mail-list {
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    }
}

/* ============================================
   ACCESSIBILITY & PERFORMANCE
   ============================================ */

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mail-card {
        border-width: 2px;
    }

    .header__title {
        text-shadow: none;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .header::after {
        display: none;
    }

    .mail-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
