/* ===== GLOBAL ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    color: #333;
}

/* ===== CONTAINER ===== */
.container {
    width: 90%;
    max-width: 900px;
    margin: 20px auto;
    background: #ffffff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* ===== HEADER ===== */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e5e7eb;
}

.header h1 {
    color: #2563eb;
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: 700;
}

.subtitle {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
}

/* ===== FORM GROUP ===== */
.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.required {
    color: #ef4444;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}

/* ===== INPUT & TEXTAREA ===== */
input[type="text"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    margin-top: 5px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #ffffff;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 150px;
    line-height: 1.6;
}

select.select-multiple {
    min-height: 120px;
    padding: 8px;
    line-height: 1.8;
}

/* ===== CATEGORY SELECTOR ===== */
.category-selector {
    position: relative;
    margin-top: 5px;
}

.select-multiple {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-multiple:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.selected-categories {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #bfdbfe;
    line-height: 1.2;
}

/* ===== TAG INPUT ===== */
.tag-input-wrapper {
    position: relative;
    margin-top: 5px;
}

.tag-input-wrapper input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.tag-input-wrapper input[type="text"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #f0f9ff;
    color: #0369a1;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #bae6fd;
    line-height: 1.2;
}

.tag-remove {
    cursor: pointer;
    color: #0369a1;
    font-weight: bold;
    font-size: 16px;
    line-height: 1;
    transition: color 0.2s;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.tag-remove:hover {
    color: #dc2626;
    background: #fee2e2;
}

/* ===== MODERN FILE UPLOAD ===== */
.modern-upload-container {
    margin-top: 5px;
}

.upload-area {
    position: relative;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    background: #fafafa;
    transition: all 0.2s ease;
    overflow: hidden;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #2563eb;
    background: #f0f7ff;
}

.upload-area.dragover {
    border-color: #10b981;
    background: #ecfdf5;
    border-style: solid;
}

.upload-area input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.upload-content {
    padding: 32px 20px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.upload-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    color: #9ca3af;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover .upload-icon {
    color: #2563eb;
}

.upload-area.dragover .upload-icon {
    color: #10b981;
}

.upload-text {
    font-size: 15px;
    font-weight: 500;
    color: #374151;
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.upload-info {
    font-size: 12px;
    color: #9ca3af;
    margin: 0;
    line-height: 1.4;
}

/* ===== FILE PREVIEW ===== */
.file-preview {
    margin-top: 15px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
    transition: all 0.2s ease;
}

.preview-card:hover {
    border-color: #d1d5db;
}

.preview-image-wrapper {
    position: relative;
    width: 70px !important;
    height: 70px !important;
    min-width: 70px;
    min-height: 70px;
    max-width: 70px;
    max-height: 70px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.preview-image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    max-width: 70px !important;
    max-height: 70px !important;
    object-fit: cover;
    display: block;
}

.remove-file {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: 1.5px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 10;
    padding: 0;
}

.remove-file svg {
    width: 10px;
    height: 10px;
    stroke-width: 2.5;
}

.remove-file:hover {
    background: #dc2626;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.preview-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 4px;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.file-size {
    font-size: 11px;
    color: #6b7280;
    margin: 0;
    line-height: 1.3;
}

.file-status {
    display: none;
}

/* Responsive untuk preview */
@media screen and (max-width: 768px) {
    .preview-card {
        flex-direction: row;
        text-align: left;
        padding: 15px;
    }
    
    .preview-image-wrapper {
        width: 60px !important;
        height: 60px !important;
        min-width: 60px;
        min-height: 60px;
        max-width: 60px;
        max-height: 60px;
    }
    
    .preview-image-wrapper img {
        max-width: 60px !important;
        max-height: 60px !important;
    }
    
    .remove-file {
        width: 16px;
        height: 16px;
        top: 3px;
        right: 3px;
    }
    
    .remove-file svg {
        width: 9px;
        height: 9px;
    }
    
    .upload-content {
        padding: 30px 15px;
    }
    
    .upload-icon {
        width: 40px;
        height: 40px;
    }
    
    .upload-text {
        font-size: 14px;
    }
    
    .upload-info {
        font-size: 12px;
    }
}

/* ===== WEBSITE SELECTOR ===== */
.website-selector {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    background: #ffffff;
    margin-top: 5px;
}

.select-all-wrapper {
    padding: 8px 10px;
    margin-bottom: 10px;
    background: #f9fafb;
    border-radius: 6px;
}

.select-all-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    color: #374151;
    margin: 0;
}

.select-all-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: white;
}

.select-all-label input[type="checkbox"]:checked + .checkbox-custom {
    background: #2563eb;
    border-color: #2563eb;
}

.select-all-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.checkbox-text {
    user-select: none;
}

.website-list {
    max-height: 220px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
    padding: 2px;
}

.website-item {
    padding: 8px 10px;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.website-item:hover {
    border-color: #2563eb;
    background: #f0f7ff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    margin: 0;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-label .checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: white;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: #2563eb;
    border-color: #2563eb;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.website-name {
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    user-select: none;
}

/* ===== BUTTON ===== */
button,
.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
    margin-top: 10px;
}

button:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.4);
}

button:active:not(:disabled),
.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled,
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content h3 {
    margin: 0 0 10px 0;
    color: #374151;
}

.loading-content p {
    margin: 0;
    color: #6b7280;
}

/* ===== ERROR & LOADING STATES ===== */
.error {
    color: #ef4444;
    padding: 15px;
    background: #fef2f2;
    border-radius: 8px;
    border-left: 4px solid #ef4444;
    margin: 10px 0;
}

.loading {
    color: #6b7280;
    padding: 15px;
    text-align: center;
    font-style: italic;
}

.error-box {
    background: #fef2f2;
    border: 2px solid #ef4444;
    padding: 30px;
    border-radius: 12px;
    margin: 20px 0;
}

.error-box h2 {
    color: #ef4444;
    margin-top: 0;
}

/* ===== RESPONSIVE ===== */
@media screen and (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        width: 100%;
        padding: 25px 20px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .website-list {
        max-height: 150px;
        grid-template-columns: 1fr;
    }
    
    .tag-list {
        margin-top: 8px;
    }
    
    .selected-categories {
        margin-top: 8px;
    }
}

/* ===== SCROLLBAR STYLING ===== */
.website-list::-webkit-scrollbar {
    width: 8px;
}

.website-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.website-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.website-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
