@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #1a1a1a;
    color: #ffffff;
    position: relative;
    min-height: 100vh;
}

#background-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 30px;
    border-radius: 5px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 2rem;
}

.back-btn {
    position: absolute;
    left: 0;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 10px 15px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.back-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

h1 {
    color: #ffffff;
    text-align: center;
    font-size: 2.5em;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.1em;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.add-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 500;
}

.add-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #fff;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #404040;
    border-radius: 5px;
    background-color: #2d2d2d;
    color: #fff;
    box-sizing: border-box;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

#add-form button {
    padding: 10px 20px;
    margin-right: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

#add-form button[type="submit"] {
    background-color: #555;
    color: white;
}

#add-form button[type="submit"]:hover {
    background-color: #666;
}

#add-form button[type="button"] {
    background-color: #404040;
    color: white;
}

#add-form button[type="button"]:hover {
    background-color: #555;
}

.radio-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.radio-group input[type="radio"] {
    display: none;
}

.radio-group label {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    margin-bottom: 0;
    cursor: pointer;
    font-weight: normal;
    background-color: #404040;
    border: 2px solid #555;
    border-radius: 5px;
    color: #ccc;
    transition: all 0.3s ease;
    user-select: none;
}

.radio-group label:hover {
    background-color: #555;
    border-color: #666;
    color: #fff;
}

.radio-group input[type="radio"]:checked + label {
    background-color: #666;
    border-color: #888;
    color: #fff;
    box-shadow: 0 0 10px rgba(136, 136, 136, 0.3);
}

.navbar {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-menu li {
    flex: 1;
    min-width: 80px;
    max-width: 120px;
}

.nav-link {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 12px 8px;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    margin: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateY(-1px);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin: 0;
    padding: 0;
}

.grid-item {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px;
    text-align: center;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.grid-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.grid-item .image-container {
    width: 100%;
    height: 55%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.grid-item .image-container img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    border-radius: 3px;
}

.grid-item .text-container {
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #eee;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.grid-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.grid-item:hover::before {
    left: 100%;
}


@media (max-width: 1200px) {
    .grid-container {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 992px) {
    .grid-container {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .nav-menu li {
        min-width: 80px;
    }
    
    .nav-link {
        padding: 12px 8px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 0 10px;
    }
    
    .nav-container {
        padding: 0 10px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-menu li {
        min-width: 50px;
        flex: 1 1 calc(25% - 5px);
        max-width: 80px;
    }
    
    .nav-link {
        padding: 8px 3px;
        font-size: 11px;
        line-height: 1.2;
        word-break: keep-all;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .grid-item {
        padding: 4px;
    }
    
    .grid-item .image-container {
        height: 50%;
        margin-bottom: 6px;
    }
    
    .grid-item .text-container {
        font-size: 12px;
        line-height: 1.2;
        padding: 2px;
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        margin: 5vh auto;
        padding: 12px;
        padding-top: 50px;
        width: calc(100% - 20px);
        max-width: none;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 8px;
    }
    
    .close {
        right: 10px;
        top: 10px;
        font-size: 24px;
        width: 36px;
        height: 36px;
    }
    
    .modal-image img, 
    .image-placeholder {
        width: 100px;
        height: 100px;
    }
    
    .type-grade-row {
        gap: 10px;
    }
    
    .modal-section {
        padding: 8px 0;
    }
    
    .label {
        font-size: 14px;
        margin-bottom: 3px;
    }
    
    .value {
        font-size: 13px;
        line-height: 1.3;
    }
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 0 8px;
    }
    
    .nav-container {
        padding: 0 5px;
    }
    
    .nav-menu li {
        min-width: 40px;
        flex: 1 1 calc(33.33% - 3px);
        max-width: 70px;
    }
    
    .nav-link {
        padding: 6px 2px;
        font-size: 10px;
        line-height: 1.1;
    }
    
    .grid-item {
        padding: 3px;
        min-height: 60px;
    }
    
    .grid-item .image-container {
        height: 60%;
        margin-bottom: 4px;
    }
    
    .grid-item .text-container {
        font-size: 10px;
        line-height: 1.1;
        padding: 1px;
    }
    
    .modal {
        padding: 5px;
    }
    
    .modal-content {
        margin: 2vh auto;
        padding: 8px;
        padding-top: 45px;
        width: calc(100% - 10px);
        max-width: none;
        max-height: 96vh;
        overflow-y: auto;
        border-radius: 5px;
    }
    
    .close {
        right: 8px;
        top: 8px;
        font-size: 22px;
        width: 32px;
        height: 32px;
    }
    
    .modal-image {
        margin-bottom: 10px;
    }
    
    .modal-image img, 
    .image-placeholder {
        width: 70px;
        height: 70px;
    }
    
    .type-grade-row {
        flex-direction: row;
        gap: 10px;
        align-items: center;
        justify-content: center;
    }
    
    .type-grade-item {
        text-align: center;
        flex: 1;
    }
    
    .type-grade-divider {
        display: block;
        font-size: 14px;
    }
    
    .modal-section {
        padding: 6px 0;
    }
    
    .label {
        font-size: 13px;
        margin-bottom: 2px;
    }
    
    .value {
        font-size: 12px;
        line-height: 1.2;
    }
    
    .recipe-section {
        padding: 8px 0;
    }
    
    .recipe-label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .recipe-content {
        padding: 6px;
        margin: 0;
    }
    
    .recipe-visual {
        gap: 3px;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .recipe-item {
        min-width: 22px;
        margin-bottom: 4px;
    }
    
    .recipe-item img,
    .recipe-placeholder {
        width: 22px;
        height: 22px;
        margin-bottom: 2px;
    }
    
    .recipe-name {
        font-size: 6px;
        max-width: 25px;
        line-height: 1;
        word-break: break-all;
    }
    
    .recipe-plus {
        font-size: 10px;
        margin: 0 1px;
        align-self: flex-start;
        margin-top: 8px;
    }
    
    .recipe-text {
        font-size: 11px;
        line-height: 1.2;
    }
}

@media (max-width: 360px) {
    .grid-container {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 0 6px;
    }
    
    .nav-menu li {
        min-width: 35px;
        max-width: 60px;
    }
    
    .nav-link {
        padding: 5px 2px;
        font-size: 9px;
        line-height: 1;
    }
    
    .grid-item .text-container {
        font-size: 10px;
    }
    
    .modal {
        padding: 2px;
    }
    
    .modal-content {
        margin: 1vh auto;
        padding: 6px;
        padding-top: 40px;
        width: calc(100% - 4px);
        max-width: none;
        max-height: 98vh;
        border-radius: 3px;
    }
    
    .close {
        right: 5px;
        top: 5px;
        font-size: 20px;
        width: 28px;
        height: 28px;
    }
    
    .modal-image img, 
    .image-placeholder {
        width: 60px;
        height: 60px;
    }
    
    .label {
        font-size: 12px;
    }
    
    .value {
        font-size: 11px;
    }
    
    .recipe-item img,
    .recipe-placeholder {
        width: 18px;
        height: 18px;
    }
    
    .recipe-name {
        font-size: 5px;
        max-width: 20px;
    }
    
    .recipe-plus {
        font-size: 8px;
        margin-top: 6px;
    }
}

/* 태블릿 최적화 */
@media (min-width: 769px) and (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 18px;
        padding: 0 20px;
    }
    
    .nav-menu li {
        min-width: 90px;
    }
    
    .nav-link {
        padding: 12px 10px;
        font-size: 13px;
    }
    
    .grid-item .text-container {
        font-size: 16px;
    }
    
    .modal-content {
        width: 85%;
        max-width: 600px;
        max-height: 85vh;
        overflow-y: auto;
    }
}

/* 터치 디바이스 최적화 */
@media (hover: none) and (pointer: coarse) {
    .nav-link {
        padding: 15px 8px;
        min-height: 44px;
        box-sizing: border-box;
    }
    
    .grid-item {
        min-height: 44px;
    }
    
    .grid-item:hover {
        background-color: #2d2d2d;
        transform: none;
        box-shadow: none;
    }
    
    .grid-item:active {
        background-color: #404040;
        transform: scale(0.98);
    }
    
    .close {
        min-width: 44px;
        min-height: 44px;
        font-size: 24px;
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 50%;
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
    padding: 0;
    box-sizing: border-box;
}

.modal-content {
    background-color: #2d2d2d;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #404040;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    position: relative;
    animation: slideIn 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    box-sizing: border-box;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 15px;
    top: 10px;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.close:hover,
.close:focus {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

#modal-title {
    margin-top: 0;
    color: #fff;
    border-bottom: 1px solid #404040;
    padding-bottom: 10px;
}

#modal-body {
    margin-top: 20px;
    color: #ccc;
    line-height: 1.6;
}

.modal-image {
    text-align: center;
    margin-bottom: 20px;
}

.modal-image img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #404040;
    display: block;
    margin: 0 auto;
}

.image-placeholder {
    width: 150px;
    height: 150px;
    background-color: #333;
    border: 2px solid #404040;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 48px;
    margin: 0 auto;
}

.image-placeholder::before {
    content: "📷";
}

.modal-section {
    padding: 15px 0;
    border-bottom: 1px solid #404040;
    border-top: 1px solid #404040;
}

.modal-section:first-of-type {
    border-top: 1px solid #404040;
}

.modal-section:last-of-type {
    border-bottom: 1px solid #404040;
}

.modal-section p {
    margin: 0;
}

.type-grade-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.type-grade-item {
    flex: 1;
    text-align: center;
}

.type-grade-item p {
    margin: 0;
}

.label {
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.value {
    color: #ccc;
}

.type-grade-divider {
    color: #666;
    font-size: 16px;
    font-weight: bold;
}

.recipe-section {
    padding: 15px 0;
    border-top: 1px solid #404040;
}

.recipe-section p {
    margin: 0;
    margin-bottom: 10px;
}

.recipe-label {
    text-align: center;
}

.recipe-content {
    background-color: #1a1a1a;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #404040;
}

.recipe-visual {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 100%;
}

.recipe-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 0 0 auto;
    min-width: 50px;
}

.recipe-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #404040;
    margin-bottom: 5px;
}

.recipe-placeholder {
    width: 40px;
    height: 40px;
    background-color: #333;
    border: 1px solid #404040;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #666;
    margin-bottom: 5px;
}

.recipe-name {
    font-size: 9px;
    color: #aaa;
    max-width: 50px;
    word-wrap: break-word;
    line-height: 1.2;
    overflow-wrap: break-word;
    hyphens: auto;
}

.recipe-plus {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    align-self: center;
    margin: 0 5px;
    flex-shrink: 0;
}

.recipe-text {
    font-style: italic;
    color: #aaa;
    margin: 0;
}

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

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

@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        padding: 15px;
        width: 95%;
    }
    
    #modal-title {
        font-size: 18px;
    }
}