/* Settings page */
.sqmedia-settings-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}
.sqmedia-settings-section h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}
.sqmedia-settings-section h3 {
    margin: 25px 0 15px;
    padding: 15px 0 10px;
    border-top: 1px solid #eee;
    color: #1d2327;
}
.sqmedia-provider-select {
    min-width: 400px;
    padding: 8px 12px;
    font-size: 14px;
}
.sqmedia-provider-settings {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}
.sqmedia-provider-settings.active {
    display: block;
}
.sqmedia-conditional-section {
    display: none;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #ddd;
}
.sqmedia-conditional-section.active {
    display: block;
}
.sqmedia-test-result {
    margin-left: 10px;
}
.sqmedia-test-result.success {
    color: #00a32a;
}
.sqmedia-test-result.error {
    color: #d63638;
}

.sqmedia-size-disabled { opacity: 0.5; }

/* Cloudflare Worker Section */
.sqmedia-cf-worker-section {
    margin-top: 20px;
    padding: 20px;
    background: #f6f7f7;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.sqmedia-cf-worker-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

/* Status Box */
.sqmedia-cf-status-box {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}
.sqmedia-cf-status-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.sqmedia-cf-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.sqmedia-cf-status-indicator.active {
    background: #00a32a;
}
.sqmedia-cf-status-indicator.inactive {
    background: #dba617;
}
.sqmedia-cf-status-text {
    color: #00a32a;
    font-weight: 600;
}
.sqmedia-cf-status-not-deployed .sqmedia-cf-status-text {
    color: #dba617;
}
.sqmedia-cf-details-table {
    margin: 10px 0;
}
.sqmedia-cf-details-table td {
    padding: 4px 10px 4px 0;
}
.sqmedia-cf-details-table code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
}
.sqmedia-cf-status-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Modal */
.sqmedia-cf-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100000;
    justify-content: center;
    align-items: center;
}
.sqmedia-cf-modal-overlay.active {
    display: flex;
}
body.sqmedia-modal-open {
    overflow: hidden;
}
.sqmedia-cf-modal {
    background: #fff;
    border-radius: 8px;
    width: 600px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.sqmedia-cf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
}
.sqmedia-cf-modal-header h2 {
    margin: 0;
    font-size: 18px;
}
.sqmedia-cf-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}
.sqmedia-cf-modal-close:hover {
    color: #d63638;
}

/* Progress Indicator */
.sqmedia-cf-progress {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
}
.sqmedia-cf-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}
.sqmedia-cf-progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 60%;
    width: 80%;
    height: 2px;
    background: #ddd;
}
.sqmedia-cf-progress-step.completed::after {
    background: #00a32a;
}
.sqmedia-cf-progress-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ddd;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 5px;
    position: relative;
    z-index: 1;
}
.sqmedia-cf-progress-step.active .sqmedia-cf-progress-number {
    background: #2271b1;
    color: #fff;
}
.sqmedia-cf-progress-step.completed .sqmedia-cf-progress-number {
    background: #00a32a;
    color: #fff;
}
.sqmedia-cf-progress-label {
    font-size: 11px;
    color: #666;
}

/* Modal Body */
.sqmedia-cf-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.sqmedia-cf-step {
    display: none;
}
.sqmedia-cf-step.active {
    display: block;
}
.sqmedia-cf-step h3 {
    margin-top: 0;
}
.sqmedia-cf-permissions-list {
    background: #f0f6fc;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 10px 10px 10px 30px;
    margin: 10px 0;
}
.sqmedia-cf-permissions-list li {
    font-family: monospace;
    font-size: 12px;
    margin: 5px 0;
}

/* Form Rows */
.sqmedia-cf-form-row {
    margin: 15px 0;
}
.sqmedia-cf-form-row > label:first-child {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}
.sqmedia-cf-form-row input[type="text"],
.sqmedia-cf-form-row input[type="password"],
.sqmedia-cf-form-row select {
    width: 100%;
    max-width: 400px;
}
.sqmedia-cf-radio,
.sqmedia-cf-checkbox {
    display: block;
    margin: 8px 0;
    font-weight: normal !important;
}
.sqmedia-cf-token-storage {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* Status Messages */
.sqmedia-cf-status-message {
    margin-top: 10px;
}
.sqmedia-cf-success {
    color: #00a32a;
}
.sqmedia-cf-error {
    color: #d63638;
}
.sqmedia-cf-warning {
    color: #dba617;
}
.sqmedia-cf-hint {
    color: #666;
    font-style: italic;
    font-size: 12px;
}
.sqmedia-cf-step-error {
    display: none;
    color: #d63638;
    background: #fcf0f1;
    border: 1px solid #d63638;
    padding: 10px;
    border-radius: 4px;
    margin-top: 15px;
}

/* Deploy Progress */
.sqmedia-cf-deploy-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}
.sqmedia-cf-deploy-step .sqmedia-cf-step-status {
    width: 20px;
    text-align: center;
}
.sqmedia-cf-deploy-step.complete .sqmedia-cf-step-status {
    color: #00a32a;
}
.sqmedia-cf-deploy-step.error .sqmedia-cf-step-status {
    color: #d63638;
}
.sqmedia-cf-deploy-step.running .sqmedia-cf-step-status::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #2271b1;
    border-top-color: transparent;
    border-radius: 50%;
    animation: sqmedia-spin 1s linear infinite;
}
@keyframes sqmedia-spin {
    to { transform: rotate(360deg); }
}
.sqmedia-cf-step-message {
    font-size: 12px;
    color: #666;
    margin-left: auto;
}
.sqmedia-cf-deploy-step.error .sqmedia-cf-step-message {
    color: #d63638;
}

/* Result Boxes */
.sqmedia-cf-result-box {
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
}
.sqmedia-cf-result-box.success {
    background: #edfaef;
    border: 1px solid #00a32a;
    color: #00a32a;
}
.sqmedia-cf-result-box.error {
    background: #fcf0f1;
    border: 1px solid #d63638;
    color: #d63638;
}

/* Undeploy Section */
.sqmedia-cf-undeploy-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}
.sqmedia-cf-undeploy-section h4 {
    color: #d63638;
    margin-bottom: 10px;
}

/* Token Instructions */
.sqmedia-cf-token-instructions {
    background: #f0f6fc;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 15px;
    margin: 15px 0;
}
.sqmedia-cf-token-instructions p {
    margin: 0 0 8px 0;
}
.sqmedia-cf-token-instructions ul {
    margin: 5px 0 15px 20px;
}
.sqmedia-cf-token-instructions ul:last-child {
    margin-bottom: 0;
}
.sqmedia-cf-numbered-list {
    margin: 5px 0 15px 20px;
    padding-left: 0;
}
.sqmedia-cf-numbered-list li {
    margin: 5px 0;
}
.sqmedia-cf-radio-description {
    display: block;
    font-weight: normal;
    color: #666;
    margin-left: 24px;
    font-size: 12px;
}
.sqmedia-cf-config-instructions {
    background: #fff8e5;
    border: 1px solid #dba617;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}
.sqmedia-cf-config-note {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #dba617;
    color: #666;
}

.sqmedia-cf-info-box {
    background: #f0f6fc;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 15px;
    margin: 10px 0;
}
.sqmedia-cf-info-box p {
    margin: 5px 0;
}

/* Status details layout */
.sqmedia-cf-status-note {
    color: #666;
    font-size: 13px;
    margin: 5px 0 15px 0;
}
.sqmedia-cf-detail-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}
.sqmedia-cf-detail-row:last-child {
    border-bottom: none;
}
.sqmedia-cf-detail-label {
    width: 80px;
    color: #666;
}
.sqmedia-cf-detail-row code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
}
.sqmedia-cf-test-success {
    color: #00a32a;
    margin-left: 5px;
}

/* Delete button */
.sqmedia-cf-delete-btn {
    color: #d63638 !important;
    border-color: #d63638 !important;
}
.sqmedia-cf-delete-btn:hover {
    background: #d63638 !important;
    color: #fff !important;
}

/* Secondary actions */
.sqmedia-cf-secondary-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 12px;
}
.sqmedia-cf-secondary-actions a {
    color: #666;
    text-decoration: none;
}
.sqmedia-cf-secondary-actions a:hover {
    color: #d63638;
    text-decoration: underline;
}
.sqmedia-cf-help-tip {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: #666;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    font-size: 11px;
    line-height: 16px;
    margin-left: 5px;
    cursor: help;
}

/* Delete confirmation modal */
.sqmedia-cf-delete-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100001;
    display: flex;
    justify-content: center;
    align-items: center;
}
.sqmedia-cf-delete-modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.sqmedia-cf-delete-modal-content h3 {
    margin-top: 0;
    color: #d63638;
}
.sqmedia-cf-delete-modal-content ul {
    background: #f6f7f7;
    padding: 10px 10px 10px 30px;
    border-radius: 4px;
    margin: 15px 0;
}
.sqmedia-cf-delete-warning {
    background: #fcf0f1;
    border: 1px solid #d63638;
    border-radius: 4px;
    padding: 10px;
    margin: 15px 0;
    color: #d63638;
}
.sqmedia-cf-delete-bucket-note {
    color: #666;
    font-size: 12px;
}
.sqmedia-cf-delete-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Code Box */
.sqmedia-cf-code-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #2c3338;
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 10px;
}
.sqmedia-cf-code-box code {
    flex: 1;
    color: #72aee6;
    background: none;
    padding: 0;
    font-size: 12px;
    word-break: break-all;
}
.sqmedia-cf-code-box .button {
    flex-shrink: 0;
}

/* Modal Footer */
.sqmedia-cf-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    background: #f9f9f9;
}
