@import '../reset.css';

:root {
    /* Skema Warna Minimalist Modern & High Contrast */
    --primary-color: #3b82f6;       
    --secondary-color: #ffffff;     

    --background-color: #f8fafc;    
    --text-color: #1e293b;          
}

html {
    font: 100%/1.4 system-ui, Helvetica, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

.wrap {
    width: min(95%, 40rem);
    margin: 2rem auto;
    padding: 1.5rem; /* Ditambah sedikit padding supaya ruang dalam kotak lebih selesa */
    background-color: var(--secondary-color);
    
    /* 1. KOTAK UTAMA: Bucu lebih bulat & bayang yang sangat halus/moden */
    border-radius: 1rem; 
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.button {
    display: block;
    background: var(--primary-color);
    color: var(--secondary-color);
    text-decoration: none;
    
    /* 2. BUTANG: Bucu bulat yang seimbang dengan kotak utama */
    border-radius: 0.5rem; 
    padding: 0.4rem 0.8rem; /* Padding disesuaikan sikit untuk gaya butang moden */
    font-weight: bold;
    text-align: center;
    /* Sedikit shadow bawah butang untuk efek klikable */
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15); 
}

.button.alert {
    background: #ef4444; 
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.15);
}

.hidden {
    display: none !important;
}

nav.main ul {
    display: flex;
    margin-bottom: 2rem;
}

nav.main li {
    list-style: none;
    flex: 1;
}

nav.main li a {
    /* inherits from .button */
}

nav.main li + li a {
    margin-left: 0.2rem;
}

.wrap .posts {

}

.wrap .posts > li {
    list-style: none;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding-bottom: 1rem;

    display: grid;
    grid-template-columns: repeat(6, 1fr);
}

.wrap .posts > li > * {
    outline: 0px solid #f0f;
}

.wrap .posts > li:last-child {
    margin-bottom: 2rem;
    border-bottom: 0;
    padding-bottom: 0;
}

.timeline .pagination { overflow: hidden; }
.timeline .pagination a {
    display: block;
    background: var(--primary-color);
    color: var(--secondary-color);
    text-decoration: none;
    border-radius: 0.5rem; /* Disamakan dengan .button */
    padding: 0.4rem 0.8rem;
    font-weight: bold;
    float: left;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15);
}
.timeline .pagination .next { float: right; }

.wrap .post-timestamp {
    display: block;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 0.5rem;
    grid-column-start: span 3;
}

.wrap .post-timestamp time.modified {
    display: block;
    color: rgba(0, 0, 0, 0.4);
    mix-blend-mode: multiply;
}

.wrap .post-meta {
    grid-column-start: span 3;
}

.wrap .post-meta ul {
    display: flex;
    justify-content: flex-end;
    gap: 0.75ch;
}

.wrap .post-meta li {
    list-style: none;
}

.wrap .post-meta li a {
    display: block;
    color: rgba(0, 0, 0, 0.4);
    mix-blend-mode: multiply;
    text-decoration: none;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.wrap .post-meta li a:is(:hover, :focus) {
    color: var(--text-color);
}

.wrap .post-meta li span.amount {
    margin-inline-end: 0.25ch;
}

.wrap .post-meta li span.word { display: inline-block; text-indent: -9999px; }
.wrap .post-meta li span.amount::after {
    display: inline-block;
    content: '';
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    vertical-align: middle;
    margin-inline-start: 0.25ch;
    opacity: 0.35;
}

.wrap .post-meta li a:is(:hover, :focus) span.amount::after {
    opacity: 1;
}

.wrap .post-meta li.post-likes span.amount::after {
    background-image: url(./icons/icon-like.svg);
    width: 0.7rem;
    height: 0.7rem;
}

.wrap .post-meta li.post-boosts span.amount::after {
    background-image: url(./icons/icon-announce.svg);
    width: 1rem;
    height: 1rem;
}

.wrap .post-content {
    font-size: 1.25rem;
    overflow-wrap: break-word;
    grid-column-start: span 6;
}

.wrap .post-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.wrap form.delete {
    width: 100%;
    grid-column-start: span 6;
    display: flex;
    margin-block-start: 2rem;
}

.wrap form.delete input[type="submit"] {
    flex: 1;
    line-height: 1.4;
    cursor: pointer;
}

.wrap .posts li .message {
    width: 100%;
    grid-column-start: span 6;
    margin-block-start: 2rem;
}

.postform form,
form.edit,
.login form {
    grid-column-start: span 6;
    overflow: hidden;
}

:is(.postform, .edit) textarea {
    width: 100%;
    border: 1px solid #e2e8f0; 
    background: #fff;
    padding: 0.75rem;
    font-size: 1.25rem;
    resize: vertical;
    min-height: 10rem;
    margin-bottom: 0.5rem;
    
    /* 3. INPUT TEXTAREA: Bucu bulat halus supaya nampak moden */
    border-radius: 0.5rem; 
}

:is(.postform, .edit) textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    /* Tambah shadow glow lembut bila fokus */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); 
}

:is(.postform, .edit) .post-nav {
    width: 100%;
    display: flex;
    gap: 1rem;
    align-items: center;
}

:is(.postform, .edit) input[type="submit"],
.login input[type="submit"] {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    display: block;
    background: var(--primary-color);
    color: var(--secondary-color);
    text-decoration: none;
    border-radius: 0.5rem; /* Disamakan bucu bulat butang */
    padding: 0.4rem 1rem;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    float: right;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.15);
}

:is(.postform, .edit) #count {
    color: #94a3b8; 
}

:is(.postform, .edit) #post-droparea {
    border: 0.15rem dashed rgba(59, 130, 246, 0.2); /* Tukar warna dash kepada ton biru lembut */
    color: rgba(0,0,0,0.4);
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.5rem; /* Bucu bulat untuk kawasan dropfile */
}

:is(.postform, .edit) #post-droparea.drag,
:is(.postform, .edit) #post-droparea:is(:hover, :focus) {
    background-color: var(--primary-color);
    color: #fff;
    border: 0.15rem solid var(--primary-color);
}

:is(.postform, .edit) #post-attachments-label {
    border: 0.15rem dashed rgba(0,0,0,0.1);
    color: rgba(0,0,0,0.4);
    display: flex;
    padding: 0.25rem;
    cursor: pointer;
    position: relative;
    align-self: stretch;
    align-items: center;
    border-radius: 0.5rem;
}

:is(.postform, .edit) #post-attachments {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

:is(.postform, .edit) #post-attachments-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    padding-inline-end: 1rem;
    align-self: stretch;
    justify-content: center;
}

:is(.postform, .edit) #post-attachments-list li + li {
    margin-block-start: 0.25em;
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-block-start: 0.25em;
}

:is(.postform, .edit) #post-attachments-list img.file-preview {
    display: inline-block;
    vertical-align: middle;
    margin-right: 1ch;
    width: 1.75rem;
    height: 1.75rem;
    outline: 0px solid #f0f;
    object-fit: cover;
    background: #fff;
    border-radius: 0.25rem; /* Mini rounded untuk imej preview */
}

:is(.postform, .edit) #post-attachments-list input[type="checkbox"] {
    -webkit-appearance: checkbox;
    appearance: checkbox;
}

:is(.timeline, .single) .post-attachments {
    grid-column-start: span 6;
    margin-block-start: 1rem;
}

:is(.timeline, .single) .post-attachments li + li {
    margin-block-start: 0.5rem;
}

:is(.postform, .edit) .message,
.login .message {
    background-color: #ecfdf5; 
    padding: 0.75rem;
    color: #065f46;            
    border-radius: 0.5rem; /* Bucu bulat box mesej */
    margin-bottom: 0.5rem;
    border: 1px solid #a7f3d0;
}

:is(.postform, .edit) .error,
.login .error {
    background-color: #fef2f2; 
    color: #991b1b;            
    border: 1px solid #fca5a5;
    border-radius: 0.5rem; /* Bucu bulat box error */
}

.login form {
    margin-top: 0.75rem;
}

.login input[type="text"],
.login input[type="password"] {
    width: 100%;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 0.75rem;
    font-size: 1.25rem;
    resize: vertical;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem; /* Bucu bulat untuk input login */
}

.login .login-nav {
    display: flex;
    gap: 1rem;
    flex-direction: row-reverse;
    justify-content: end;
    align-items: center;
}

.login input[type="submit"] {
    float: none;
}

.login input[type="text"]:focus,
.login input[type="password"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.settings .post-nav {
    display: flex;
    justify-content: flex-end;
}

.settings fieldset {
    margin-block: 1rem 2rem;
}

.settings fieldset legend {
    text-transform: uppercase;
    font-weight: 700;
    font-size: 85%;
    margin-block-end: 1rem;
}

.settings fieldset dl {
    display: grid;
    grid-template-columns: 2fr 3fr;
    grid-gap: 1.25rem 0;
}

.settings fieldset :is(dt, dd) {
    padding: 0.25em 0.5rem 0.25em 0;
    border-bottom: 0px solid CanvasText;
    outline: 0px solid red;
}

.settings fieldset dt label {
    font-size: 85%;
}

.settings fieldset dd :is(select, input[type="radio"], input[type="checkbox"]) {
    all: revert;
    font-size: 1rem;
}

.settings fieldset dd :is(input[type="text"], textarea) {
    width: 100%;
    padding: 0.4em 0.6em;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem; /* Kemaskan input setting dengan bucu bulat kecil */
}

.settings fieldset dd :is(input, textarea)::placeholder {
    opacity: 0.4;
}

footer {
    width: min(95%, 40rem);
    margin: 0.5rem auto 2rem;
}

footer ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

footer li a {
    color: rgba(0, 0, 0, 0.616)
}

.profile-pic {
  width: 145px;          /* Tetapkan lebar gambar */
  height: 145px;         /* Tetapkan tinggi yang SAMA dengan lebar */
  border-radius: 50%;    /* Ini yang akan buat gambar jadi bulat */
  object-fit: cover;     /* PENTING: Supaya gambar tak penyek/kemek */
  border: 3px solid #fff; /* Opsional: Letak border putih macam IG Story */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Opsional: Kesan bayang lembut */
}

/* Bekas luar video */
.video-container {
    position: relative;
    padding-bottom: 56.25%; /* Ini adalah nisbah aspek 16:9 (9 dibahagi 16 = 0.5625) */
    padding-top: 30px; 
    height: 0;
    overflow: hidden;
    max-width: 100%; /* Memastikan ia tidak terlebih saiz skrin */
    margin-bottom: 20px;
}

/* Mengawal iframe di dalam bekas tersebut */
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;  /* Lebar akan sentiasa 100% mengikut saiz skrin/device */
    height: 100%; /* Tinggi akan laras automatik mengikut nisbah 16:9 tadi */
}