* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    font-size: 100%;
    background: #666 url('cork-board.webp') center center;
    background-size: cover;
    background-attachment: fixed;
    color: #fff;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

/* Screen Management */
.screen {
    width: 100%;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Authentication Screen */
#auth-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1em;
}

.auth-container {
    background: rgba(139, 90, 43, 0.9);
    background-image: url('cork-board.webp');
    background-size: cover;
    background-position: center;
    padding: 2em;
    border-radius: 10px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 3px solid rgba(101, 67, 33, 0.8);
    position: relative;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(139, 90, 43, 0.7);
    border-radius: 10px;
    z-index: 0;
}

.auth-container > * {
    position: relative;
    z-index: 1;
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 1.5em;
    font-size: 2em;
}

#auth-tabs {
    display: flex;
    gap: 0.5em;
    margin-bottom: 1.5em;
}

.tab-btn {
    flex: 1;
    padding: 0.75em;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.3);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form input {
    width: 100%;
    padding: 0.75em;
    margin-bottom: 1em;
    border: none;
    border-radius: 5px;
    font-size: 1em;
}

.btn-primary {
    width: 100%;
    padding: 0.75em;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #45a049;
}

.error-message {
    color: #ff6b6b;
    margin-top: 0.5em;
    font-size: 0.9em;
    min-height: 1.5em;
}

/* Main App Screen */
header {
    background: rgba(139, 90, 43, 0.85);
    background-image: url('cork-board.webp');
    background-size: cover;
    background-position: center;
    padding: 1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1em;
    border-bottom: 3px solid rgba(101, 67, 33, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(139, 90, 43, 0.6);
    z-index: 0;
}

header > * {
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: 1.5em;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: bold;
}

.header-search {
    flex: 1;
    max-width: 400px;
    margin: 0 1em;
}

.search-input {
    width: 100%;
    padding: 0.75em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    font-size: 1em;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.search-input::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

.header-actions {
    display: flex;
    gap: 0.5em;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

/* Notes Container */
#notes-container {
    padding: 1em;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 0;
}

#notes-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5em;
    padding: 1em 0;
}

#notes-list li {
    position: relative;
}

.note-card {
    text-decoration: none;
    color: #000;
    background: #ffc;
    display: block;
    min-height: 200px;
    padding: 1.5em;
    box-shadow: 5px 5px 7px rgba(33, 33, 33, 0.7);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
    transform: rotate(-2deg);
    position: relative;
}

.note-card:nth-child(even) {
    transform: rotate(2deg);
}

.note-card:nth-child(3n) {
    transform: rotate(-1deg);
}

.note-card:nth-child(5n) {
    transform: rotate(1.5deg);
}

.note-card:hover {
    box-shadow: 10px 10px 7px rgba(0, 0, 0, 0.7);
    transform: scale(1.05) rotate(0deg) !important;
    z-index: 5;
    position: relative;
}

.note-card h2 {
    font-size: 1.4em;
    font-weight: bold;
    padding-bottom: 0.3em;
    margin-bottom: 0.3em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.note-card .note-meta {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 0.5em;
    font-family: Arial, sans-serif;
}

.note-card p {
    font-family: "Patrick Hand", "Comic Sans MS", cursive, sans-serif;
    font-size: 1.1em;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1em;
}

.modal-content {
    background: #ffc;
    color: #000;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 5px 5px 7px rgba(33, 33, 33, 0.7);
    padding: 2em;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1em;
    margin-bottom: 1em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 1em;
    flex: 1;
}

.modal-header h2 {
    margin: 0;
    color: #000;
    font-size: 1.8em;
    font-weight: bold;
}

.modal-header .color-options {
    display: flex;
    gap: 0.5em;
    align-items: center;
}

.btn-close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    color: #000;
    line-height: 1;
    padding: 0.2em 0.4em;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background 0.2s;
}

.btn-close:hover {
    background: rgba(0, 0, 0, 0.2);
}

.modal-body {
    padding: 0;
}

.modal-body input,
.modal-body textarea {
    width: 100%;
    padding: 0.75em;
    margin-bottom: 1em;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    font-size: 1em;
    font-family: Arial, sans-serif;
    color: #000;
}

.modal-body input::placeholder,
.modal-body textarea::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

.modal-body input:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.8);
}

.modal-body textarea {
    resize: vertical;
    min-height: 200px;
    font-family: "Patrick Hand", "Comic Sans MS", cursive, sans-serif;
    font-size: 1.2em;
    line-height: 1.6;
}

.color-options {
    display: flex;
    gap: 0.5em;
    align-items: center;
    flex-wrap: wrap;
}

.color-options input[type="radio"] {
    display: none;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.color-option:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.color-options input[type="radio"]:checked + .color-option {
    border-color: #000;
    transform: scale(1.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
    margin-bottom: 1em;
}

.modal-actions-center {
    display: flex;
    gap: 0.5em;
    flex: 1;
    justify-content: center;
}

.btn-secondary {
    padding: 0.75em 1.5em;
    background: rgba(33, 150, 243, 0.8);
    color: #000;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    font-weight: bold;
    box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
    background: rgba(33, 150, 243, 1);
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
}

.btn-danger {
    padding: 0.75em 1.5em;
    background: rgba(244, 67, 54, 0.8);
    color: #000;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    font-weight: bold;
    box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.2);
}

.btn-danger:hover {
    background: rgba(244, 67, 54, 1);
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.2);
    font-weight: bold;
}

.btn-primary:hover {
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
}

#share-section {
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

#share-section input {
    margin-bottom: 0.5em;
}

.shared-list {
    margin-top: 1em;
    font-size: 0.9em;
}

.shared-list .shared-user {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5em;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    margin-bottom: 0.5em;
}

.shared-list .remove-share {
    background: rgba(244, 67, 54, 0.8);
    color: #000;
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 0.25em 0.5em;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: bold;
    transition: background 0.2s;
}

.shared-list .remove-share:hover {
    background: rgba(244, 67, 54, 1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .auth-container {
        padding: 1.5em;
    }

    header {
        padding: 0.75em;
        flex-direction: column;
        align-items: stretch;
    }

    header h1 {
        font-size: 1.2em;
        margin-bottom: 0.5em;
    }

    .header-search {
        max-width: 100%;
        margin: 0.5em 0;
    }

    .header-actions {
        margin-top: 0.5em;
    }

    #notes-list {
        grid-template-columns: 1fr;
        gap: 1em;
        padding: 0.5em 0;
    }

    .note-card {
        min-height: 150px;
        padding: 1em;
    }

    .note-card h2 {
        font-size: 1.2em;
    }

    .note-card p {
        font-size: 1.1em;
    }

    .modal-content {
        max-height: 95vh;
        margin: 0.5em;
        padding: 1.5em;
        transform: rotate(0deg);
    }

    .modal-header {
        padding-bottom: 0.75em;
        margin-bottom: 0.75em;
    }

    .modal-body {
        padding: 0;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .auth-container h1 {
        font-size: 1.5em;
    }

    #notes-list {
        padding: 0.25em 0;
    }

    .note-card {
        min-height: 120px;
        padding: 0.75em;
    }
}
