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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0d0d1a;
    color: #e0e0e0;
    min-height: 100vh;
}

/* ========== HEADER ========== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #13132a;
    border-bottom: 1px solid #2a2a4a;
}

header h1 {
    font-size: 1.3rem;
    color: #b393f5;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #7c5cbf;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.btn:hover { background: #9473d6; }

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
}

.btn-danger {
    background: #8b3040;
}
.btn-danger:hover { background: #a93d50; }

.btn-upload {
    background: #2a5050;
    cursor: pointer;
}
.btn-upload:hover { background: #3a6868; }

/* ========== MAIN ========== */
main {
    padding: 1.5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* ========== CARDS ========== */
.card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    color: #b393f5;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* ========== TABLE ========== */
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #2a2a4a;
}
th {
    color: #8a8ab0;
    font-size: 0.8rem;
    text-transform: uppercase;
}
td code {
    background: #252545;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #d4a5ff;
}

/* ========== FORMS ========== */
.form-inline {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    align-items: center;
}

.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    color: #8a8ab0;
    font-size: 0.85rem;
}
.form-group small {
    display: block;
    margin-top: 0.2rem;
    color: #666;
    font-size: 0.75rem;
}

input[type="text"],
input[type="number"],
input[type="password"] {
    padding: 0.5rem 0.8rem;
    background: #0d0d1a;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.9rem;
    width: 100%;
    max-width: 300px;
}
input:focus {
    outline: none;
    border-color: #7c5cbf;
}

/* ========== LOGIN ========== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
}
.login-box {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 2.5rem;
    text-align: center;
    width: 340px;
}
.login-box h1 {
    font-size: 1.6rem;
    color: #b393f5;
}
.login-box h2 {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1.5rem;
}
.login-box input {
    width: 100%;
    max-width: none;
    margin-bottom: 1rem;
}
.login-box button {
    width: 100%;
}

.error {
    background: #3a1520;
    border: 1px solid #8b3040;
    color: #ff7088;
    padding: 0.5rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

/* ========== COLOR GRID ========== */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.2rem;
}

.color-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.color-card:hover {
    border-color: #7c5cbf;
}

/* ========== 360° PREVIEW ========== */
.color-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #0d0d1a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    overflow: hidden;
}
.color-preview:active { cursor: grabbing; }

.color-preview img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    pointer-events: none;
}

.drag-hint {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #888;
}

/* ========== COLOR INFO ========== */
.color-info {
    padding: 0.8rem 1rem;
}
.color-info h3 {
    font-size: 1rem;
    color: #d4a5ff;
    margin-bottom: 0.3rem;
}
.color-info .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    font-size: 0.78rem;
    color: #666;
}
.color-info .meta code {
    background: #252545;
    padding: 1px 5px;
    border-radius: 3px;
    color: #aaa;
    font-size: 0.75rem;
}

.status {
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.status.active {
    background: #1a3a2a;
    color: #4caf50;
}
.status.inactive {
    background: #3a1a1a;
    color: #f44336;
}

/* ========== COLOR ACTIONS ========== */
.color-actions {
    padding: 0.6rem 1rem;
    border-top: 1px solid #2a2a4a;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* ========== MISC ========== */
.empty {
    text-align: center;
    color: #666;
    padding: 3rem;
    font-size: 0.9rem;
}

.section-title {
    color: #b393f5;
    font-size: 1.2rem;
    margin-bottom: 1.2rem;
}

/* ========== PRODUCT GRID ========== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.product-card {
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, transform 0.15s;
    cursor: pointer;
    display: block;
}
.product-card:hover {
    border-color: #7c5cbf;
    transform: translateY(-2px);
}
.product-icon {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
}
.product-card h3 {
    color: #d4a5ff;
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}
.product-desc {
    color: #666;
    font-size: 0.83rem;
    margin-bottom: 0.8rem;
}
.product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    font-size: 0.78rem;
    color: #888;
}
.product-meta code {
    background: #252545;
    padding: 1px 5px;
    border-radius: 3px;
    color: #aaa;
}
.color-count {
    background: #252545;
    padding: 2px 8px;
    border-radius: 10px;
    color: #b393f5;
    font-weight: 600;
}
.product-card-new {
    border-style: dashed;
    border-color: #3a3a5a;
    opacity: 0.7;
}
.product-card-new:hover {
    opacity: 1;
    border-color: #7c5cbf;
}

/* ========== COLOR LINKS ========== */
.color-preview-link {
    text-decoration: none;
    color: inherit;
}
.color-info h3 a {
    color: #d4a5ff;
    text-decoration: none;
}
.color-info h3 a:hover {
    text-decoration: underline;
}

/* ========== DETAIL INFO ========== */
.detail-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: #aaa;
}
.detail-info code {
    background: #252545;
    padding: 2px 6px;
    border-radius: 4px;
    color: #d4a5ff;
}
.detail-info strong {
    color: #e0e0e0;
}

/* ========== LARGE 360 PREVIEW ========== */
.preview-360-large {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    margin: 0 auto;
    background: #0d0d1a;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    overflow: hidden;
}
.preview-360-large:active { cursor: grabbing; }
.preview-360-large img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    pointer-events: none;
}

/* ========== UPLOAD FORM ========== */
.upload-form {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}
.upload-form input[type="file"] {
    color: #aaa;
    font-size: 0.85rem;
}
.hint {
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 0.8rem;
}

/* ========== FRAME GRID ========== */
.frame-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.6rem;
}
.frame-item {
    background: #0d0d1a;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    overflow: hidden;
}
.frame-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    display: block;
}
.frame-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 6px;
    font-size: 0.7rem;
    color: #666;
    background: #13132a;
}
.btn-icon {
    background: none;
    border: none;
    color: #8b3040;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 4px;
}
.btn-icon:hover {
    color: #ff5070;
}
