/* DeepDebate Embed Widget Styles */

:root {
    --dd-blue: #007AFF;
    --dd-purple: #9433EB;
    --dd-text: #1C1C1F;
    --dd-text-light: #6B7280;
    --dd-bg: #FFFFFF;
    --dd-bg-light: #F9FAFB;
    --dd-border: #E5E7EB;
    --dd-success: #10B981;
    --dd-error: #EF4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--dd-bg);
    color: var(--dd-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#widget-container {
    padding: 1.5rem;
    min-height: 200px;
}

/* States */
.widget-state {
    display: flex;
    flex-direction: column;
}

.widget-state.hidden {
    display: none;
}

/* Loading State */
#loading-state {
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--dd-text-light);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--dd-border);
    border-top-color: var(--dd-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error State */
#error-state {
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--dd-error);
}

.error-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--dd-error);
    color: white;
    font-size: 24px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

/* Header */
.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.widget-category {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.1), rgba(148, 51, 235, 0.1));
    color: var(--dd-purple);
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.widget-brand {
    text-decoration: none;
    font-size: 0.75rem;
    color: var(--dd-text-light);
}

.brand-text {
    font-weight: 600;
    background: linear-gradient(135deg, var(--dd-blue), var(--dd-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Title */
.widget-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--dd-text);
}

/* Vote Bars */
.vote-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.vote-bar-container {
    position: relative;
    height: 44px;
    background: var(--dd-bg-light);
    border-radius: 8px;
    overflow: hidden;
}

.vote-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 8px;
    transition: width 0.5s ease;
}

.vote-bar-a {
    background: linear-gradient(135deg, var(--dd-blue), #4DA3FF);
}

.vote-bar-b {
    background: linear-gradient(135deg, var(--dd-purple), #B366F0);
}

.vote-label {
    position: absolute;
    top: 50%;
    left: 1rem;
    right: 1rem;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--dd-text);
    z-index: 1;
}

.vote-percent {
    font-weight: 700;
}

.vote-count {
    text-align: center;
    font-size: 0.75rem;
    color: var(--dd-text-light);
    margin-bottom: 1.5rem;
}

/* Vote Buttons */
.vote-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.vote-btn {
    flex: 1;
    padding: 0.875rem 1rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.vote-btn:hover {
    transform: translateY(-2px);
}

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

.vote-btn-a {
    background: linear-gradient(135deg, var(--dd-blue), #4DA3FF);
    color: white;
}

.vote-btn-a:hover {
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.vote-btn-b {
    background: linear-gradient(135deg, var(--dd-purple), #B366F0);
    color: white;
}

.vote-btn-b:hover {
    box-shadow: 0 4px 12px rgba(148, 51, 235, 0.3);
}

/* Auth Section */
.auth-section {
    border-top: 1px solid var(--dd-border);
    padding-top: 1rem;
}

.auth-prompt {
    font-size: 0.875rem;
    color: var(--dd-text-light);
    margin-bottom: 0.75rem;
    text-align: center;
}

.phone-input-group {
    display: flex;
    gap: 0.5rem;
}

.country-select {
    padding: 0.75rem;
    border: 1px solid var(--dd-border);
    border-radius: 8px;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
}

.phone-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--dd-border);
    border-radius: 8px;
    font-size: 0.875rem;
}

.phone-input:focus {
    outline: none;
    border-color: var(--dd-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.send-code-btn {
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--dd-blue), var(--dd-purple));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.send-code-btn:hover {
    opacity: 0.9;
}

.send-code-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Verification Section */
.verify-section {
    border-top: 1px solid var(--dd-border);
    padding-top: 1rem;
}

.verify-prompt {
    font-size: 0.875rem;
    color: var(--dd-text-light);
    margin-bottom: 0.75rem;
    text-align: center;
}

.code-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.code-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--dd-border);
    border-radius: 8px;
    font-size: 1.25rem;
    text-align: center;
    letter-spacing: 0.5rem;
}

.code-input:focus {
    outline: none;
    border-color: var(--dd-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.verify-code-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--dd-blue), var(--dd-purple));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.verify-code-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.resend-btn {
    background: none;
    border: none;
    color: var(--dd-blue);
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
}

/* Voted State */
.voted-state {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--dd-border);
}

.voted-check {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--dd-success);
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
}

.voted-text {
    font-size: 0.875rem;
    color: var(--dd-text-light);
    margin-bottom: 0.75rem;
}

.voted-text span {
    font-weight: 600;
    color: var(--dd-text);
}

.change-vote-btn {
    background: none;
    border: 1px solid var(--dd-border);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--dd-text-light);
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.change-vote-btn:hover {
    border-color: var(--dd-blue);
    color: var(--dd-blue);
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* reCAPTCHA container */
#recaptcha-container {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
}

/* Responsive */
@media (max-width: 400px) {
    #widget-container {
        padding: 1rem;
    }

    .widget-title {
        font-size: 1.1rem;
    }

    .phone-input-group {
        flex-direction: column;
    }

    .vote-buttons {
        flex-direction: column;
    }
}
