/* Reset & Global Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0a0a0a;
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}
.background-gradient {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent: 50%), radial-gradient(circle at 80% 80%, rgba(255, 77, 109, 0.3) 0%, transparent: 50%), radial-gradient(circle at 40% 90%, rgba(99, 102, 241, 0.2) 0%, transparent: 50%);
    pointer-events: none; z-index: -1;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

header.main-header { padding: 60px 0; text-align: center; }
.header-content { display: flex; flex-direction: column; align-items: center; }
.back-btn { display: inline-block; margin-bottom: 25px; align-self: flex-start; }
.logo {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px; margin: 0 auto 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; box-shadow: 0 10px 40px rgba(102, 126, 234, 0.5);
    animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
h1 {
    font-size: 3em; font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    margin-bottom: 15px; letter-spacing: -2px;
}
.subtitle { font-size: 1.2em; color: #888; font-weight: 300; max-width: 600px; margin: 0 auto; }
.section-title {
    text-align: center; font-size: 2.5em; font-weight: 700; margin-bottom: 40px;
    background: linear-gradient(135deg, #fff 0%, #aaa 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.categories-header { text-align: center; margin-bottom: 60px; }
.categories-toggle-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px; cursor: pointer; padding: 15px 25px;
    transition: all 0.3s ease-in-out;
}
.categories-toggle-btn:hover { transform: scale(1.05); background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.2); }
.categories-toggle-btn .section-title { margin: 0 25px; white-space: nowrap; font-size: 2.2em; margin-bottom: 0; }
.arrow { width: 12px; height: 12px; border-left: 3px solid #888; border-bottom: 3px solid #888; transform: rotate(-45deg); transition: transform 0.3s ease-in-out, border-color 0.3s; }
.categories-toggle-btn:hover .arrow { border-color: #fff; }
.animated-arrow { animation: bounce 2s infinite; }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0) rotate(-45deg); } 40% { transform: translateY(8px) rotate(-45deg); } 60% { transform: translateY(4px) rotate(-45deg); } }
.categories-toggle-btn:not(.is-collapsed) .arrow { transform: rotate(135deg); animation: none;  }
.categories-grid-wrapper { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.5s ease-in-out; }
.categories-grid-wrapper:not(.collapsed) { grid-template-rows: 1fr; }
#mainCategoriesGrid { overflow: hidden; padding-top: 20px; }


.main-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.about-section {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    gap: 20px; padding: 40px 20px;
    background: rgba(20, 20, 20, 0.5); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px; margin-bottom: 60px;
}
.about-photo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 3px solid #667eea; }
.about-content h2 { font-size: 2em; margin-bottom: 10px; }
.about-content p { max-width: 600px; color: #aaa; line-height: 1.7; margin-bottom: 20px; }

.about-contact {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.contact-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: #a3b3ff;
    text-decoration: none;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    transition: all 0.3s;
    font-size: 1.2em;
}

.contact-icon-link:hover {
    background: rgba(102, 126, 234, 0.2);
    color: #fff;
    transform: scale(1.1);
}

.skills-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.skill-tag {
    background: rgba(102, 126, 234, 0.2); color: #a3b3ff;
    padding: 5px 15px; border-radius: 20px;
    font-size: 14px; font-weight: 500;
}
.admin-panel {
    background: rgba(20, 20, 20, 0.8); backdrop-filter: blur(20px);
    padding: 20px; border-radius: 20px; margin-bottom: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: none; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 15px;
}
.admin-panel-buttons { display: flex; flex-wrap: wrap; gap: 10px; }

.category-tile, .main-category-tile {
    position: relative; aspect-ratio: 16 / 10; border-radius: 24px;
    overflow: hidden; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.category-tile:hover, .main-category-tile:hover {
    transform: translateY(-10px);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
}
.category-tile-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover; background-position: center; transition: transform 0.4s;
}
.category-tile:hover .category-tile-bg, .main-category-tile:hover .category-tile-bg { transform: scale(1.05); }
.category-tile-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.1) 100%);
}
.category-tile-content { position: absolute; bottom: 20px; left: 20px; right: 20px; z-index: 2; }
.category-tile-content h3 {
    font-size: 1.8em; font-weight: 700; color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.category-tile-actions {
    position: absolute; top: 15px; right: 15px; z-index: 3;
    display: flex; gap: 10px; opacity: 0; transition: opacity 0.3s;
}
.category-tile:hover .category-tile-actions, .main-category-tile:hover .category-tile-actions { opacity: 1; }

.btn-icon {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.2);
    color: #fff; display: flex; align-items: center;
    justify-content: center; cursor: pointer; transition: all 0.2s;
}
.btn-icon:hover { background: rgba(0,0,0,0.7); transform: scale(1.1); }
.btn-icon-danger:hover { background: #e74c3c; border-color: #e74c3c; }

.site-description-section {
    padding: 40px 20px;
    background: rgba(20, 20, 20, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    margin: 0 0 60px 0;
    transition: opacity 0.5s, visibility 0.5s, max-height 0.5s, margin 0.5s, padding 0.5s;
    max-height: 1000px;
    opacity: 1;
    visibility: visible;
    overflow: hidden;
}

.site-description-section.hidden {
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
}

.rich-text-content,
.project-detail-description {
    color: #ccc;
    line-height: 1.9;
    font-size: 1.1em;
}
.rich-text-content .ql-editor {
    padding: 0;
}
.rich-text-content .ql-editor > *:last-child,
.project-detail-description .ql-editor > *:last-child {
    margin-bottom: 0;
}

.rich-text-content p, .project-detail-description p,
.rich-text-content ol li, .project-detail-description ol li,
.rich-text-content ul li, .project-detail-description ul li {
    color: #ccc;
    margin-bottom: 1em;
}

.rich-text-content h1, .project-detail-description h1,
.rich-text-content h2, .project-detail-description h2,
.rich-text-content h3, .project-detail-description h3 {
    margin: 20px 0 10px 0;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #fff 0%, #aaa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rich-text-content a, .project-detail-description a {
    color: #a3b3ff;
    text-decoration: underline;
}

.rich-text-content ul, .project-detail-description ul,
.rich-text-content ol, .project-detail-description ol {
    margin-left: 20px;
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.rich-text-content img, .project-detail-description img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 16px 0;
}

.rich-text-content .ql-align-center, .project-detail-description .ql-align-center { text-align: center; }
.rich-text-content .ql-align-right, .project-detail-description .ql-align-right { text-align: right; }
.rich-text-content .ql-align-justify, .project-detail-description .ql-align-justify { text-align: justify; }
.rich-text-content .ql-size-small, .project-detail-description .ql-size-small { font-size: 0.75em; }
.rich-text-content .ql-size-large, .project-detail-description .ql-size-large { font-size: 1.5em; }
.rich-text-content .ql-size-huge, .project-detail-description .ql-size-huge { font-size: 2.5em; }

.rich-text-content blockquote, .project-detail-description blockquote {
    border-left: 4px solid #667eea;
    margin: 15px 0;
    padding: 10px 20px;
    color: #aaa;
    background: rgba(102, 126, 234, 0.05);
}

.rich-text-content pre.ql-syntax, .project-detail-description pre.ql-syntax {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 8px;
    white-space: pre-wrap;
    font-family: 'Courier New', Courier, monospace;
}

.view-container.hidden { 
    display: none; 
}

#projectsView, #subCategoriesView {
    margin-bottom: 60px;
}
.categories-grid-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 30px; }
.project-wrapper { display: flex; flex-direction: column; gap: 10px; }
.project-card-link { text-decoration: none; color: inherit; display: block; flex-grow: 1; }
.project-card {
    background: rgba(25, 25, 25, 0.7); backdrop-filter: blur(20px);
    border-radius: 24px; overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%; display: flex; flex-direction: column; position: relative;
}
.project-card:hover { transform: translateY(-10px); border-color: rgba(102, 126, 234, 0.5); box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3); }
.project-price {
    position: absolute; top: 15px; right: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; padding: 5px 12px; border-radius: 20px;
    font-size: 14px; font-weight: 700; z-index: 2;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.project-image { width: 100%; height: 220px; object-fit: cover; transition: transform 0.4s; }
.project-card:hover .project-image { transform: scale(1.05); }
.project-content { padding: 25px; flex-grow: 1; display: flex; flex-direction: column; }
.project-title { font-size: 1.5em; font-weight: 700; margin-bottom: 12px; }
.project-description { color: #aaa; line-height: 1.7; flex-grow: 1; }
.project-actions { display: flex; gap: 10px; }
.read-more-container { text-align: right; margin-top: 15px; }
.btn-secondary {
    background: transparent; border: 1px solid rgba(255, 255, 255, 0.2); color: #aaa;
    font-weight: 500; padding: 8px 16px; border-radius: 12px;
    display: inline-block; transition: all 0.3s;
}
.project-card:hover .btn-secondary {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.5);
    color: #a3b3ff;
}

.back-link { display: inline-block; margin-bottom: 40px; color: #aaa; text-decoration: none; font-size: 16px; transition: color 0.3s; }
.back-link:hover { color: #fff; }
.project-detail-container { padding: 40px 0; max-width: 900px; margin: 0 auto; }
.project-detail-image { width: 100%; border-radius: 15px; margin-bottom: 30px; }
.project-detail-title {
    font-size: 3em; margin-bottom: 20px; font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}
.gallery-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.gallery-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.gallery-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
}
.gallery-modal-image {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 10px;
}
.gallery-close {
    position: absolute;
    top: 20px; right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}
.gallery-close:hover { color: #ccc; }
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}
.gallery-nav:hover { background: rgba(255,255,255,0.2); }
.gallery-prev { left: 20px; }
.gallery-next { right: 20px; }

.app-link-container { margin-top: 30px; }
.unlock-form-container {
    background: rgba(20, 20, 20, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px; padding: 30px; text-align: center;
}
.unlock-form-container p { margin-bottom: 20px; color: #aaa; font-size: 1.1em; }
.unlock-form-container form {
    display: flex; flex-direction: column;
    gap: 15px; max-width: 350px; margin: 0 auto;
}
@media (min-width: 480px) {
    .unlock-form-container form { flex-direction: row; }
}
.unlock-form-container input { flex-grow: 1; }

.project-detail-link { margin-top: 20px; }
.btn {
    background: rgba(102, 126, 234, 0.2); border: 1px solid rgba(102, 126, 234, 0.5);
    color: #a3b3ff; padding: 10px 20px; border-radius: 12px;
    cursor: pointer; font-size: 14px; font-weight: 600;
    transition: all 0.3s; text-decoration: none; display: inline-block; text-align: center;
}
.btn:hover { background: rgba(102, 126, 234, 0.3); transform: translateY(-2px); }
.btn-danger { background: rgba(231, 76, 60, 0.2); border-color: rgba(231, 76, 60, 0.5); color: #e74c3c; }
.btn-danger:hover { background: rgba(231, 76, 60, 0.3); }
.btn-add, .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none; color: white; padding: 12px 24px; font-size: 15px;
}
.btn-add:hover, .btn-primary:hover { box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4); }
.logout-btn { background: rgba(231, 76, 60, 0.2); border: 1px solid rgba(231, 76, 60, 0.5); color: #e74c3c; }
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9); z-index: 3000;
    overflow-y: auto; padding: 20px;
}
.modal-content {
    background: rgba(20, 20, 20, 0.95); backdrop-filter: blur(40px);
    max-width: 600px; margin: 5vh auto; padding: 30px;
    border-radius: 30px; position: relative; border: 1px solid rgba(255, 255, 255, 0.1);
}
.close { position: absolute; right: 20px; top: 20px; font-size: 32px; cursor: pointer; color: #999; transition: all 0.3s; z-index: 10; }
.close:hover { color: #fff; transform: rotate(90deg); }
.modal-content h2 { margin-bottom: 30px; font-size: 1.8em; }
.form-group { margin-bottom: 25px; }
label { display: block; margin-bottom: 10px; color: #aaa; font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
input, textarea, select {
    width: 100%; padding: 15px 20px; background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px;
    font-size: 16px; color: #fff; transition: all 0.3s; font-family: inherit;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
}
select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: #667eea; background: rgba(255, 255, 255, 0.08); box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); }
textarea { min-height: 150px; resize: vertical; }
footer { text-align: center; padding: 60px 20px 40px; color: #555; font-size: 14px; position: relative; border-top: 1px solid rgba(255, 255, 255, 0.05); margin-top: 40px; }
.copyright a, .copyright { cursor: pointer; transition: color 0.3s; text-decoration: none; color: #555; }
.copyright:hover, .copyright a:hover { color: #667eea; }
.empty-state {
    text-align: center; padding: 80px 20px;
    background: rgba(20, 20, 20, 0.6); backdrop-filter: blur(20px);
    border-radius: 24px; border: 1px solid rgba(255, 255, 255, 0.1);
    grid-column: 1 / -1;
}
.empty-state.small { padding: 40px 20px; }
.empty-state.small h4 { color: #aaa; font-weight: 400; }
.empty-state h2 { color: #fff; }
@media (min-width: 768px) {
    h1 { font-size: 4em; } .subtitle { font-size: 1.3em; } .modal-content { padding: 50px; }
    .about-section { flex-direction: row; text-align: left; gap: 40px; }
    .about-photo { width: 150px; height: 150px; }
    .skills-container, .about-contact { justify-content: flex-start; }
}
@media (max-width: 480px) {
    h1 { font-size: 2.5em; } .subtitle { font-size: 1.1em; }
    .btn { padding: 8px 16px; font-size: 13px; }
    .btn-add, .btn-primary { padding: 10px 20px; font-size: 14px; }
    .back-btn { padding: 8px 12px; }
    header.main-header { padding: 40px 0; }
    .categories-toggle-btn .section-title { font-size: 1.8em; margin: 0 15px;}
}

.ql-toolbar { border-top-left-radius: 12px; border-top-right-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1) !important; border-bottom: 0 !important; }
.ql-container { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1) !important; background: rgba(255, 255, 255, 0.05); color: #fff; font-family: inherit; font-size: 16px; }
.ql-editor { min-height: 200px; resize: vertical; overflow-y: auto; }
.ql-editor.ql-blank::before { color: rgba(255, 255, 255, 0.4) !important; font-style: normal !important; left: 20px; }
.ql-snow .ql-stroke { stroke: #aaa; }
.ql-snow .ql-picker-label { color: #aaa !important; }
.ql-snow .ql-fill { fill: #aaa; }
.ql-snow .ql-picker:not(.ql-color-picker):not(.ql-icon-picker) svg { padding-top: 2px; }
.ql-snow .ql-picker-options { background-color: #1e1e1e; border-color: rgba(255, 255, 255, 0.2) !important; border-radius: 8px; padding: 5px; }
.ql-snow .ql-picker.ql-color-picker .ql-picker-item { border-radius: 4px; }
.ql-snow.ql-toolbar .ql-picker-item:hover, .ql-snow.ql-toolbar .ql-picker-item.ql-selected { color: #667eea !important; }
.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke, .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke { stroke: #667eea !important; }


