/* SmartApp Styles */
:root {
    --primary-color: #25D366;
    --secondary-color: #128C7E;
    --accent-color: #34B7F1;
    --text-color: #333333;
    --light-gray: #f5f5f5;
    --border-radius: 8px;
    --box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Form Styles */
.smartapp-form-wrapper {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.smartapp-form {
    position: relative;
}

.smartapp-form h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.8rem;
}

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

.smartapp-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.95rem;
}

.smartapp-form label .required {
    color: #e74c3c;
    margin-left: 4px;
}

.smartapp-form input[type="text"],
.smartapp-form input[type="tel"],
.smartapp-form input[type="email"],
.smartapp-form textarea,
.smartapp-form select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #fff;
}

.smartapp-form input[type="text"]:focus,
.smartapp-form input[type="tel"]:focus,
.smartapp-form input[type="email"]:focus,
.smartapp-form textarea:focus,
.smartapp-form select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.smartapp-form textarea {
    min-height: 120px;
    resize: vertical;
}

.smartapp-form select {
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333333" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 40px;
}

.smartapp-submit {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.smartapp-submit:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.smartapp-submit:active {
    transform: translateY(0);
}

.smartapp-submit .dashicons {
    font-size: 1.2rem;
    width: auto;
    height: auto;
}

/* Loading State */
.smartapp-form.loading {
    opacity: 0.7;
    pointer-events: none;
}

.smartapp-form.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading Icon Animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.smartapp-submit .dashicons-update {
    animation: spin 1s linear infinite;
}

/* Messages */
.smartapp-messages {
    margin: 15px 0;
}

.smartapp-success,
.smartapp-error {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    animation: slideIn 0.3s ease;
}

.smartapp-success {
    background-color: #d1fae5;
    border: 1px solid #34d399;
    color: #065f46;
}

.smartapp-error {
    background-color: #fee2e2;
    border: 1px solid #f87171;
    color: #991b1b;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Form Field Animations */
.form-group {
    animation: slideIn 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .smartapp-form-wrapper {
        margin: 1rem;
        padding: 1.5rem;
    }

    .smartapp-form input[type="text"],
    .smartapp-form input[type="tel"],
    .smartapp-form input[type="email"],
    .smartapp-form textarea,
    .smartapp-form select {
        padding: 10px 14px;
    }

    .smartapp-submit {
        padding: 0.8rem 1.5rem;
    }
}

/* Custom Form Builder Styles */
.field-controls {
    display: grid;
    grid-template-columns: 1fr 2fr auto auto;
    gap: 12px;
    align-items: center;
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.field-controls select,
.field-controls input[type="text"] {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.field-controls select:focus,
.field-controls input[type="text"]:focus {
    border-color: #25D366;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.field-controls label {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4b5563;
    font-size: 14px;
}

#form-preview {
    background: #ffffff;
    padding: 25px;
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    margin-top: 25px;
    min-height: 200px;
}

#form-preview .form-group {
    position: relative;
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

#form-preview .form-group:hover {
    border-color: #25D366;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.1);
}

#form-preview .form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #374151;
    cursor: move;
}

#form-preview .form-group label .required {
    color: #ef4444;
    margin-left: 4px;
}

#form-preview .form-control {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #9ca3af;
    cursor: not-allowed;
}

#form-preview textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.field-delete {
    position: absolute;
    right: 10px;
    top: 10px;
    background: #ef4444;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 18px;
    line-height: 1;
}

#form-preview .form-group:hover .field-delete {
    opacity: 1;
}

.field-delete:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Form Actions */
.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.form-actions .button {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-actions .button-primary {
    background: #25D366;
    border-color: #25D366;
    color: white;
}

.form-actions .button-primary:hover {
    background: #128C7E;
    border-color: #128C7E;
    transform: translateY(-2px);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group {
    animation: slideIn 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .field-controls {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .field-controls label {
        justify-content: flex-start;
    }
    
    #form-preview {
        padding: 15px;
    }
    
    #form-preview .form-group {
        padding: 15px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .button {
        width: 100%;
        text-align: center;
    }
}

/* Admin Styles */
.smartapp-admin-wrap {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #f4f7fc;
}

.smartapp-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.smartapp-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.smartapp-table th,
.smartapp-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.smartapp-table th {
    background-color: var(--light-gray);
    font-weight: 600;
}

.smartapp-table tr:hover {
    background-color: #f9f9f9;
}

/* Animations */
.smartapp-form {
    animation: fadeIn 0.5s ease-out;
}

/* Select Field Styles */
.field-controls select,
#form-preview select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px !important;
    cursor: pointer;
    width: 100%;
    max-width: 100%;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
    background-color: #ffffff;
    transition: all 0.2s ease;
    min-height: 42px;
}

.field-controls select:hover,
#form-preview select.form-control:hover {
    border-color: #25D366;
}

.field-controls select:focus,
#form-preview select.form-control:focus {
    border-color: #25D366;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

/* Disabled state untuk preview */
#form-preview select.form-control:disabled {
    background-color: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.75;
}

/* Firefox specific styles */
@-moz-document url-prefix() {
    .field-controls select,
    #form-preview select.form-control {
        text-indent: 0.01px;
        text-overflow: '';
        padding-right: 40px;
    }
}

/* IE specific styles */
select::-ms-expand {
    display: none;
}

/* Placeholder style */
select option[value=""] {
    color: #9ca3af;
}

/* Option styles */
select option {
    color: #374151;
    padding: 8px 12px;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .field-controls select,
    #form-preview select.form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 8px 35px 8px 12px;
    }
}

/* Select Wrapper Styles */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.select-wrapper select {
    width: 100% !important;
    padding-right: 40px !important;
}

.select-wrapper select:disabled + .select-wrapper::after {
    opacity: 0.5;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .select-wrapper::after {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    }
} 