/* Instagram Giveaway Picker - Clean & Minimal Design */

:root {
    --primary: #0095f6;
    --primary-hover: #0081d6;
    --secondary: #737373;
    --background: #fafafa;
    --surface: #ffffff;
    --text: #262626;
    --text-secondary: #737373;
    --border: #dbdbdb;
    --success: #00a86b;
    --error: #ed4956;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 0.875rem;
}

.alert-error {
    background: #fef2f2;
    color: var(--error);
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--background);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-large {
    padding: 14px 28px;
    font-size: 1rem;
}

/* Login Screen */
.login-screen {
    display: flex;
    justify-content: center;
    padding-top: 48px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow);
    max-width: 400px;
    width: 100%;
}

.login-card h2 {
    margin-bottom: 12px;
    font-size: 1.25rem;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.875rem;
}

.requirements {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: left;
}

.requirements h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.requirements ul {
    list-style: none;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.requirements li {
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
}

.requirements li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--border);
}

/* Sections */
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.section h2 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.count-badge {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.input-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

input[type="url"],
input[type="number"],
input[type="text"] {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 0.875rem;
    transition: border-color 0.15s ease;
    outline: none;
}

input:focus {
    border-color: var(--primary);
}

.input-large {
    flex: 1;
}

.input-small {
    width: 80px;
    text-align: center;
}

/* Participants List */
.participants-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.participant {
    background: var(--background);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text);
    transition: all 0.15s ease;
}

.participant.highlight {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

/* Picker Controls */
.picker-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

/* Winner Display */
.winner-display {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.winner {
    background: linear-gradient(135deg, var(--primary), #833ab4);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius);
    font-size: 1.125rem;
    font-weight: 600;
    animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop-in {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.winner-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "...";
    animation: dots 1s infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* Shuffle Animation */
@keyframes shuffle {
    0%, 100% { opacity: 1; background: var(--background); }
    50% { opacity: 0.5; background: var(--primary); color: white; }
}

.shuffling .participant {
    animation: shuffle 0.15s ease-in-out;
}

/* Responsive - Mobile First */
@media (max-width: 640px) {
    .container {
        padding: 12px;
    }

    header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .section {
        padding: 16px;
    }

    .section h2 {
        font-size: 0.75rem;
    }

    .input-group {
        flex-direction: column;
        gap: 10px;
    }

    .input-large {
        width: 100%;
    }

    input[type="url"],
    input[type="number"],
    input[type="text"] {
        padding: 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .btn {
        width: 100%;
        padding: 14px 20px;
    }

    .btn-large {
        padding: 16px 24px;
        font-size: 1rem;
    }

    .login-card {
        padding: 24px;
    }

    .login-card h2 {
        font-size: 1.125rem;
    }

    .participants-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 6px;
        max-height: 250px;
    }

    .participant {
        padding: 6px 10px;
        font-size: 0.8125rem;
    }

    .picker-controls .input-group {
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }

    .winner {
        padding: 12px 20px;
        font-size: 1rem;
    }

    .winner-actions {
        flex-direction: column;
        gap: 10px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .container {
        padding: 8px;
    }

    header h1 {
        font-size: 1.1rem;
    }

    .participants-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}
