/**
 * VoteSecure Organizer Page Styles
 * Import common.css first
 */

@import url('common.css');


/* ============================================================================
   Headers
   ============================================================================ */

/* Connected Wallet Button Styles */
.organizer-page #connectWalletBtn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.organizer-page #connectWalletBtn.connected {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

.organizer-page #connectWalletBtn.connected:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
}

.organizer-page #connectWalletBtn.loading {
  opacity: 0.7;
  cursor: wait;
}

/* Wallet Info Display */
#walletInfo {
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#walletInfo.show {
  opacity: 1;
}

.wallet-details {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}

.wallet-label {
  font-weight: 600;
  color: var(--dark);
}

.wallet-balance {
  font-weight: 600;
  color: var(--success);
}

.wallet-network {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray);
  padding: 0.25rem 0.5rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}


/* ============================================================================
   FORMS
   ============================================================================ */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--gray);
    font-size: 0.875rem;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.radio-option:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.radio-option input[type="radio"] {
    margin-top: 0.25rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.radio-option input[type="radio"]:checked + .radio-content {
    color: var(--primary);
}

.radio-content strong {
    display: block;
    margin-bottom: 0.25rem;
}

.radio-content p {
    margin: 0;
    color: var(--gray);
    font-size: 0.875rem;
}

/* ============================================================================
   ELECTION FORM (ORGANIZER)
   ============================================================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.page-header h1 {
    margin: 0;
    font-size: 28px;
}

.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-header p {
    color: var(--gray);
    font-size: 1.125rem;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.progress-steps .step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
    background: var(--bg);
}

.progress-steps .step-number {
    width: 40px;
    height: 40px;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--gray);
    transition: var(--transition);
}

.progress-steps .step.active .step-number {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.progress-steps .step.completed .step-number {
    background: var(--success);
    border-color: var(--success);
    color: var(--white);
}

.progress-steps .step-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray);
}

.progress-steps .step.active .step-label {
    color: var(--primary);
}

.election-form {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.form-step {
    display: none;
}

.form-step.active {
    display: block;
}

.form-step h2 {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.form-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border);
}

/* Question Cards */
.question-card {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.question-header h4 {
    margin: 0;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.option-item input[type="text"] {
    flex: 1;
}

.btn-remove {
    background: var(--error);
    color: var(--white);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-remove:hover {
    background: #dc2626;
}

.btn-remove-small {
    background: var(--light-gray);
    color: var(--dark);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-remove-small:hover {
    background: var(--error);
    color: var(--white);
}

/* Review Section */
.review-section,
.cost-estimate {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.review-section h3,
.cost-estimate h3 {
    margin-bottom: 1rem;
}

.review-item {
    margin-bottom: 1.5rem;
}

.review-questions {
    margin-bottom: 1.5rem;
    list-style-position: inside;
    padding-left: 0;
}

.review-questions .q-header {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.review-questions .q-header em {
    font-weight: normal;
    color: var(--gray);
    font-size: 0.9rem;
}

.review-questions .option-list {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    color: var(--gray);
}

.review-questions .option-list li {
    margin-bottom: 0.25rem;
}

.review-item strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.review-item p {
    color: var(--gray);
    margin-bottom: 0.5rem;
}

.review-item ul {
    margin-left: 1.5rem;
    color: var(--gray);
}

.cost-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cost-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--white);
    border-radius: var(--radius-sm);
}

.cost-row.total {
    background: var(--primary);
    color: var(--white);
    font-weight: 700;
    margin-top: 0.5rem;
}

.cost-note {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--gray);
}

.warning-box {
    background: #fef3c7;
    border: 2px solid #fbbf24;
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.warning-box strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #92400e;
}

.warning-box ul {
    margin-left: 1.5rem;
    color: #92400e;
}

/* ============================================================================
   MY ELECTIONS
   ============================================================================ */

.elections-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.election-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 24px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s, transform 0.2s;
}

.election-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.election-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.election-card-header h3 {
    margin: 0;
    flex: 1;
    font-size: 20px;
    color: #333;
    font-weight: 600;
}

.election-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.election-stat {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.stat-label {
    font-weight: 600;
    color: var(--gray);
}

.stat-value {
    font-weight: 700;
    color: var(--dark);
}

.election-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.election-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.election-actions button,
.election-actions a {
    flex: 1;
    min-width: 140px;
    padding: 10px 16px;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 16px;
}

.loading-message {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

/* ============================================================================
   MODALS
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

/* Receipt Card */
.receipt-card {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.receipt-card h3 {
    margin-bottom: 0.5rem;
}

.receipt-card > p {
    color: var(--gray);
    margin-bottom: 1.5rem;
}

.receipt-field {
    margin-bottom: 1rem;
}

.receipt-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.hash-display,
.url-display {
    background: var(--white);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.875rem;
    word-break: break-all;
    margin-bottom: 0.5rem;
}

.receipt-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Success Message */
.success-message {
    background: #d1fae5;
    border: 2px solid var(--success);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.success-message h3 {
    color: #065f46;
    margin-bottom: 0.5rem;
}

.success-message p {
    color: #047857;
    margin: 0;
}

.published-info {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
}

.info-field {
    margin-bottom: 1.5rem;
}

.info-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.info-field .value {
    background: var(--white);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.875rem;
    word-break: break-all;
    margin-bottom: 0.5rem;
}

/* Dropdown menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    margin-top: 5px;
    z-index: 1000;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    transition: background 0.2s;
}

.dropdown-menu button:hover {
    background: #f5f5f5;
}

.dropdown-menu hr {
    margin: 5px 0;
    border: none;
    border-top: 1px solid #e0e0e0;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .progress-steps {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .progress-steps::before {
        display: none;
    }

    .progress-steps .step {
        flex: 0 0 calc(33.333% - 0.75rem);
    }

    .progress-steps .step-label {
        font-size: 0.75rem;
    }

    .election-form {
        padding: 1.5rem;
    }

    .form-navigation {
        flex-direction: column;
    }

    .form-navigation button {
        width: 100%;
    }

    .election-card-header {
        flex-direction: column;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-actions {
        width: 100%;
        flex-direction: column;
    }

    .page-actions button,
    .page-actions .btn {
        width: 100%;
    }

    .radio-option {
        padding: 0.875rem;
    }

    .modal-content {
        width: 95%;
        max-width: 95%;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions button {
        width: 100%;
    }

    .dropdown-menu {
        right: auto;
        left: 0;
        min-width: 100%;
    }
}

/* Mobile phones (narrow screens) */
@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.5rem;
    }

    .page-header p {
        font-size: 0.875rem;
    }

    .progress-steps {
        gap: 0.5rem;
    }

    .progress-steps .step {
        flex: 0 0 calc(50% - 0.25rem);
        min-width: 0;
    }

    .progress-steps .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    .progress-steps .step-label {
        font-size: 0.7rem;
        text-align: center;
    }

    .election-form {
        padding: 1rem;
    }

    .form-step h2 {
        font-size: 1.375rem;
        margin-bottom: 1.5rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-group label {
        font-size: 0.9rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 0.9375rem;
        padding: 0.625rem 0.875rem;
    }

    .radio-option {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .radio-content strong {
        font-size: 0.9375rem;
    }

    .radio-content p {
        font-size: 0.8125rem;
    }

    .question-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .form-navigation {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
        gap: 0.75rem;
    }

    .election-card {
        padding: 1rem;
    }

    .election-card-header h3 {
        font-size: 1.125rem;
    }

    .election-actions {
        flex-direction: column;
    }

    .election-actions button,
    .election-actions a {
        width: 100%;
        min-width: 0;
    }

    .review-section,
    .cost-estimate {
        padding: 1rem;
    }

    .warning-box {
        padding: 1rem;
        font-size: 0.875rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .receipt-card,
    .published-info {
        padding: 1rem;
    }

    .hash-display,
    .url-display,
    .info-field .value {
        font-size: 0.75rem;
        padding: 0.625rem;
    }

    .wallet-details {
        flex-direction: column;
        gap: 0.25rem;
        font-size: 0.75rem;
    }

    #walletInfo {
        width: 100%;
    }

    .dropdown {
        width: 100%;
    }

    .dropdown > button {
        width: 100%;
    }

    .page-actions {
        gap: 0.5rem;
    }
}
