/* =============================================================================
   anket.com.tr — Main Stylesheet
   Mobile-first, Turkish flag theme (red #E30000 / white)
   ============================================================================= */

/* ─── CSS Variables ────────────────────────────────────────────────────────── */
:root {
    --red:          #e30000;
    --red-dark:     #b50000;
    --red-light:    #ff4444;
    --white:        #ffffff;
    --off-white:    #f8f8f8;
    --gray-100:     #f1f3f5;
    --gray-200:     #e9ecef;
    --gray-300:     #dee2e6;
    --gray-600:     #6c757d;
    --gray-800:     #343a40;
    --text:         #212529;
    --border:       #dee2e6;
    --shadow:       0 2px 12px rgba(0,0,0,.08);
    --shadow-hover: 0 4px 20px rgba(0,0,0,.14);
    --radius:       8px;
    --radius-sm:    4px;
    --transition:   0.2s ease;
    --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono:    'Consolas', 'Courier New', monospace;
}

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--gray-100);
    margin: 0;
    padding: 0;
}
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin-top: 0; font-weight: 700; }

/* ─── Layout ────────────────────────────────────────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */
.site-header {
    background: var(--red);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 0;
    gap: 1rem;
}
.site-logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--white) !important;
    text-decoration: none !important;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.logo-icon { font-size: 1.5rem; }
.logo-text { white-space: nowrap; }

/* Navigation */
.site-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
}
.nav-link {
    color: rgba(255,255,255,.85);
    padding: .4rem .75rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    text-decoration: none !important;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,.2);
    color: var(--white);
}
.nav-admin {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
}
.nav-admin:hover {
    background: var(--white);
    color: var(--red) !important;
}

/* Hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: .5rem;
}
.nav-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: var(--transition);
}

/* ─── Main ──────────────────────────────────────────────────────────────────── */
.site-main {
    padding: 2rem 0;
    min-height: calc(100vh - 130px);
}

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-header {
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.card-header h2 {
    margin: 0;
    color: var(--gray-800);
    font-size: 1.3rem;
}
.card-title {
    font-size: 1.4rem;
    color: var(--gray-800);
    margin-bottom: .5rem;
}

/* ─── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: .95rem;
}
.alert-success { background: #e8f5e9; border-left: 4px solid #4caf50; color: #1b5e20; }
.alert-error   { background: #ffebee; border-left: 4px solid #f44336; color: #b71c1c; }
.alert-warning { background: #fff8e1; border-left: 4px solid #ffc107; color: #7f6003; }
.alert-info    { background: #e3f2fd; border-left: 4px solid #2196f3; color: #0d47a1; }
.alert-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: .6;
    line-height: 1;
    padding: 0 0 0 .5rem;
}
.alert-close:hover { opacity: 1; }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .65rem 1.4rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
    text-decoration: none !important;
    line-height: 1.2;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}
.btn-primary:hover:not(:disabled) {
    background: var(--red-dark);
    border-color: var(--red-dark);
    color: var(--white);
}
.btn-outline {
    background: transparent;
    color: var(--red);
    border-color: var(--red);
}
.btn-outline:hover:not(:disabled) {
    background: var(--red);
    color: var(--white);
}
.btn-secondary {
    background: var(--gray-600);
    color: var(--white);
    border-color: var(--gray-600);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--gray-800);
    border-color: var(--gray-800);
    color: var(--white);
}
.btn-success {
    background: #2e7d32;
    color: var(--white);
    border-color: #2e7d32;
}
.btn-success:hover:not(:disabled) { background: #1b5e20; border-color: #1b5e20; color: var(--white); }
.btn-danger {
    background: #c62828;
    color: var(--white);
    border-color: #c62828;
}
.btn-danger:hover:not(:disabled) { background: #b71c1c; border-color: #b71c1c; color: var(--white); }
.btn-sm { padding: .4rem .9rem; font-size: .875rem; }
.btn-lg { padding: .9rem 2rem; font-size: 1.1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ─── Poll / Vote Form ───────────────────────────────────────────────────────── */
.poll-hero {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    color: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}
.poll-hero h1 { font-size: 1.6rem; margin-bottom: .5rem; }
.poll-hero p  { opacity: .9; margin: 0; font-size: 1rem; }
.poll-meta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
    font-size: .85rem;
    opacity: .85;
}

.vote-form { }
.vote-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
    margin-bottom: 1.5rem;
}
.vote-option {
    position: relative;
}
.vote-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.vote-option label {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .9rem 1.1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--white);
    font-size: .95rem;
}
.vote-option label:hover {
    border-color: var(--red);
    background: #fff5f5;
    box-shadow: var(--shadow-hover);
}
.vote-option input[type="radio"]:checked + label {
    border-color: var(--red);
    background: #fff5f5;
    box-shadow: 0 0 0 3px rgba(227,0,0,.15);
}
.party-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}
.party-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}
.party-logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
    letter-spacing: -.5px;
}
.party-color-square {
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,.12);
}
.party-info { flex: 1; }
.party-name { font-weight: 700; display: block; }
.party-leader { font-size: .8rem; color: var(--gray-600); }
.option-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.vote-option input[type="radio"]:checked + label .option-check {
    background: var(--red);
    border-color: var(--red);
}
.vote-option input[type="radio"]:checked + label .option-check::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--white);
}

.vote-submit-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ─── CAPTCHA ───────────────────────────────────────────────────────────────── */
.captcha-box {
    margin: 1.25rem 0 1rem;
    padding: 1rem 1.25rem;
    background: var(--gray-100);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-left: 4px solid var(--red);
}
.captcha-label {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: .6rem;
}
.captcha-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.captcha-question {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .35rem .85rem;
    font-family: var(--font-mono);
    letter-spacing: 2px;
    user-select: none;
}
.captcha-input {
    width: 90px;
    padding: .5rem .75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    transition: border-color var(--transition);
}
.captcha-input:focus {
    outline: none;
    border-color: var(--red);
}
.captcha-hint {
    display: block;
    margin-top: .4rem;
    font-size: .78rem;
    color: var(--gray-600);
}

/* ─── Results / Chart ────────────────────────────────────────────────────────── */
.results-chart-wrap {
    position: relative;
    margin-bottom: 2rem;
    max-height: 450px;
}

/* ─── 3D Animated Chart ──────────────────────────────────────────────────────── */
.chart3d-wrap {
    padding: .5rem 0 1rem;
}
.chart3d-row {
    display: flex;
    align-items: center;
    margin-bottom: .8rem;
    gap: .75rem;
}
.chart3d-label {
    width: 130px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
    line-height: 1.3;
}
.chart3d-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.chart3d-track {
    flex: 1;
    display: flex;
    align-items: center;
    gap: .5rem;
    position: relative;
    perspective: 400px;
}
/* 3D bar container — initially 0 width, animates to --bar-pct */
.chart3d-bar {
    position: relative;
    height: 28px;
    width: 0;
    animation: barGrow 1s cubic-bezier(.22,.61,.36,1) forwards;
    animation-delay: var(--bar-delay, 0ms);
}
@keyframes barGrow {
    0%   { width: 0; }
    100% { width: var(--bar-pct); }
}

/* Front face */
.chart3d-bar-front {
    position: absolute;
    inset: 0;
    border-radius: 3px 0 0 3px;
}
/* Top face */
.chart3d-bar-top {
    position: absolute;
    top: -7px;
    right: -7px;
    left: 7px;
    height: 8px;
    transform: skewX(45deg);
    border-radius: 2px 2px 0 0;
    opacity: .85;
}
/* Side face */
.chart3d-bar-side {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 8px;
    bottom: 0;
    transform: skewY(-45deg);
    border-radius: 0 2px 2px 0;
    opacity: .7;
}
.chart3d-pct {
    font-size: .85rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    min-width: 3.2rem;
}

@media (max-width: 480px) {
    .chart3d-label { width: 90px; font-size: .75rem; }
}

.result-bars { margin-bottom: 1.5rem; }
.result-bar-item {
    margin-bottom: 1rem;
}
.result-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .3rem;
    font-size: .9rem;
}
.result-bar-label { font-weight: 600; }
.result-bar-pct   { font-weight: 700; color: var(--red); }
.result-bar-track {
    height: 22px;
    background: var(--gray-200);
    border-radius: 11px;
    overflow: hidden;
}
.result-bar-fill {
    height: 100%;
    border-radius: 11px;
    transition: width .8s ease;
    min-width: 4px;
    display: flex;
    align-items: center;
    padding-left: .5rem;
    font-size: .75rem;
    color: var(--white);
    font-weight: 700;
}
.result-total {
    text-align: right;
    font-size: .9rem;
    color: var(--gray-600);
    margin-top: .5rem;
}

/* ─── Archive ────────────────────────────────────────────────────────────────── */
.archive-list {
    display: grid;
    gap: 1rem;
}
.archive-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: box-shadow var(--transition);
}
.archive-card:hover { box-shadow: var(--shadow-hover); }
.archive-info h3 { margin: 0 0 .25rem; font-size: 1rem; }
.archive-info .meta { font-size: .82rem; color: var(--gray-600); }
.badge {
    display: inline-block;
    padding: .2em .6em;
    border-radius: 12px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-closed   { background: var(--gray-200); color: var(--gray-600); }
.badge-active   { background: #e8f5e9; color: #2e7d32; }
.badge-draft    { background: #fff8e1; color: #7f6003; }

/* ─── Page Header ────────────────────────────────────────────────────────────── */
.page-header {
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.6rem;
    color: var(--gray-800);
    margin: 0 0 .25rem;
}
.page-header p {
    color: var(--gray-600);
    margin: 0;
    font-size: .95rem;
}
.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: .35rem;
    color: var(--gray-800);
}
.form-control {
    display: block;
    width: 100%;
    padding: .6rem .85rem;
    font-size: 1rem;
    font-family: var(--font);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(227,0,0,.12);
}
.form-control::placeholder { color: var(--gray-600); opacity: .75; }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: .8rem; color: var(--gray-600); margin-top: .3rem; }
.form-error { font-size: .85rem; color: var(--red); margin-top: .3rem; }

/* ─── Table ──────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.table th, .table td {
    padding: .7rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    background: var(--gray-100);
    font-weight: 700;
    color: var(--gray-800);
    white-space: nowrap;
}
.table tbody tr:hover { background: var(--gray-100); }
.table .actions { white-space: nowrap; display: flex; gap: .4rem; }

/* ─── Stats Grid ─────────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 4px solid var(--red);
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--red);
    line-height: 1;
    margin-bottom: .25rem;
}
.stat-card .stat-label { font-size: .82rem; color: var(--gray-600); font-weight: 500; }

/* ─── Admin Layout ───────────────────────────────────────────────────────────── */
.admin-body { background: #f0f2f5; }
.admin-header {
    background: #1a1a2e;
    color: var(--white);
    padding: .75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.admin-header .header-inner {
    padding: 0;
}
.admin-logo {
    color: var(--white) !important;
    font-weight: 800;
    font-size: 1.1rem;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.admin-logo span.accent { color: var(--red-light); }
.admin-nav { display: flex; align-items: center; gap: .25rem; }
.admin-nav a {
    color: rgba(255,255,255,.75);
    padding: .4rem .75rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    text-decoration: none !important;
    transition: all var(--transition);
}
.admin-nav a:hover, .admin-nav a.active {
    background: rgba(255,255,255,.15);
    color: var(--white);
}
.admin-nav a.logout {
    color: #ff6b6b;
    border: 1px solid rgba(255,107,107,.3);
}
.admin-nav a.logout:hover { background: #ff6b6b; color: var(--white); }

/* ─── No Content ─────────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-600);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .5; }
.empty-state h3 { color: var(--gray-800); margin-bottom: .5rem; }

/* ─── Voted Banner ───────────────────────────────────────────────────────────── */
.voted-banner {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border: 1px solid #4caf50;
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}
.voted-banner .voted-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.voted-banner h3 { margin: 0 0 .5rem; color: #2e7d32; }
.voted-banner p  { margin: 0; color: #388e3c; font-size: .9rem; }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--gray-800);
    color: rgba(255,255,255,.6);
    padding: 1.5rem 0;
    font-size: .85rem;
}
.footer-inner { text-align: center; }
.footer-inner p { margin: .25rem 0; }
.footer-copy { color: rgba(255,255,255,.8); font-weight: 500; }

/* ─── Color strip ─────────────────────────────────────────────────────────────── */
.flag-strip {
    height: 4px;
    background: linear-gradient(90deg, var(--red) 50%, var(--white) 50%);
    margin-bottom: 2rem;
    border-radius: 2px;
}

/* ─── Loading Spinner ─────────────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.4);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .nav-toggle { display: flex; }
    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--red-dark);
        flex-direction: column;
        padding: .5rem;
        box-shadow: 0 4px 12px rgba(0,0,0,.2);
        gap: .1rem;
    }
    .site-nav.open { display: flex; }
    .nav-link { width: 100%; padding: .65rem 1rem; }
    .site-header { position: relative; }

    .poll-hero h1 { font-size: 1.3rem; }
    .vote-option label { gap: .75rem; padding: .75rem .9rem; }
    .party-logo, .party-logo-placeholder { width: 32px; height: 32px; }
    .archive-card { flex-direction: column; align-items: flex-start; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .page-header-row { flex-direction: column; align-items: flex-start; }
    .vote-submit-row { flex-direction: column; }
    .vote-submit-row .btn { width: 100%; justify-content: center; }
}

@media (min-width: 640px) {
    .vote-options {
        grid-template-columns: repeat(2, 1fr);
    }
    .container { padding: 0 1.5rem; }
}

@media (min-width: 960px) {
    .container { padding: 0 2rem; }
}
